import java.util.Arrays;
class Scratch{
public static void main(String[] args){
int[] arr = new int[3];
System.out.println( Arrays.toString( arr ));
//prints [0, 0, 0]
}
}
int[] myArray = {0, 1, 2, 3};
System.out.println(Arrays.toString(myArray));
//prints [0, 1, 2, 3]
public class Array {
public static void main(String[] args) {
int[] array = {1, 2, 3, 4, 5}; //Your array
for (int element: array) { //Advanced For Loop (For each)
System.out.println(element); //print each element of
//the array for each iteration
}
}
}
String[] array = new String[] {"John", "Mary", "Bob"};
System.out.println(Arrays.toString(array));
Arrays.toString(array)