Array Initialization and Default Values
What is printed as a result of executing the following code segment?
public class ObjectArray {
public static void main(String[] args) {
String[] words = new String[3];
words[0] = "Hello";
words[1] = "World";
System.out.println(words[0] + " " + words[2]);
}
}
A
Hello null
B
Hello
C
Hello World
D
null World
Question Leaderboard
Not enough data yet to show leaderboard.
APFIVE