Home / Programming MCQs / JAVA MCQs / Question

S

Shivam • 8.86K Points
Tutor III

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, it is a.length() not a.length
(C) Compilation error, arrays cannot be initialized to zero size.
(D) None of the above

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.