/* Declare an integer array of size 50, assign each slot the value of its index and print the array. Sample Run: 0 1 2 3 ... 47 48 49 */ import java.util.Arrays; //We need this to use the toString() method to print the array class Quiz10_28 { public static void main(String [] args) { int [] arr = new int[50]; // declaring an integer array of size 50 for(int i=0;i<50;i++) //We run a loop from 0 to 49, since arrays are 0 indexed. arr[i]=i; System.out.println(Arrays.toString(arr)); // Arrays.toString is a staic method. // you can also use a for loop for this. } }