A

Admin • 831K Points
Coach

Q. What is the result of compiling and running the following code?

Code:
public class Test{
public static void main(String[] args){
int[] a = new int[0];
System.out.print(a.length);
}
}
  • (A) 0
  • (B) Compilation error, arrays cannot be initialized to zero size.
  • (C) Compilation error, it is a.length() not a.length
  • (D) None of the above
  • Correct Answer - Option(A)
  • Views: 14
  • Filed under category Java
  • Hashtags:

Explanation by: Admin
Step 1:

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.