Q. How do you declare and initialize an array of integers with 5 elements in Java?

  • (A) int[] numbers = new int[5];
  • (B) int[5] numbers; numbers = {1, 2, 3, 4, 5};
  • (C) int numbers[5] = {1, 2, 3, 4, 5};
  • (D) All of the above
πŸ’¬ Discuss
βœ… Correct Answer: (A) int[] numbers = new int[5];

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
119
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Ranjeet
Publisher
πŸ“ˆ
86%
Success Rate