Which two cause a compiler error?
Reveal answer
Fill a bubble to check yourself
Which two cause a compiler error?
int[] scores = {3, 5, 7};
int [][] scores = {2,7,6}, {9,3,45};
String cats[] = {“Fluffy”, “Spot”, “Zeus”};
boolean results[] = new boolean [3] {true, false, true};
Option A is valid 1D array initialization. Option B has two errors: missing inner braces for 2D structure, and incorrect syntax - should be {{2,7,6}, {9,3,45}}. Option C is valid String array. Option D is invalid - cannot specify size [3] when using array initialization syntax; either use new boolean[3] or the initialization syntax, not both.