Question discussion

What is the result of compiling and running the following code?public class Test{ public static void main(String[] args){ int[] a = new int…

281501Medium 0 replies 1,481 views
31
What is the result of compiling and running the following code?public class Test{ public static void main(String[] args){ int[] a = new int[0]; System.out.print(a.length); }}
  • A0
  • BCompilation error, arrays cannot be initialized to zero size.
  • CCompilation error, it is a.length() not a.length
  • DNone of the above
Correct answer: A

Discussion 0

Nobody has replied yet. Start the discussion!