A

Admin • 833.24K Points
Coach

Q. What will this print?
String[] names = new String[2];
names[1] = "John";
System.out.println(names[0]);

  • (A) John
  • (B) null
  • (C) undefined
  • (D) 0
  • Correct Answer - Option(B)
  • Views: 34
  • Filed under category Java
  • Hashtags: Java Array

Explanation by: Admin

names[0] was not initialized, so it remains null.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.