What is the following code execution result?

String data[];
data = {"one", "two", "three"};
System.out.println(data[1]);
Explanation
Initialization list is only allowed for usage during either array declaration:
String data[] = {"one", "two", "three"};
or array creation with the use of the new operator:
data = new String[] {"one", "two", "three"};

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes