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
πŸ’¬ Discuss
βœ… Correct Answer: (A) 0
Explanation: Step 1:
Explanation by: Neelam Mittal
Step 1:

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
98
Total Visits
πŸ“½οΈ
2 y ago
Published
πŸŽ–οΈ
Neelam Mittal
Publisher
πŸ“ˆ
93%
Success Rate