/*Print Array Using For Loop*/
//programming789.blogspot.com/
import java.util.Arrays;class PrintArray
{
public static void main(String args[])
{
int Arr[] = new int[]{1,2,3,4,5,6,7,8,9,10};
for(int i=0; i< 10; i++)
{
System.out.print(Arr[i] +", ");
}
}
}
● Save the file as PrintArray.java.
Output:
>java PrintArray
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,