Given the following code, what is the expected outcome?
public class Test { public static void main(String [] a) { int [] b = [1,2,3,4]; System.out.println("a[2]=" + a[2]); } }
D.
The declaration of the integer array is incorrect.
An array is declared by using curly braces {} instead of square brackets [].