Q. How do you declare a one-dimensional array in Java?

  • (A) int[] myArray;
  • (B) int myArray[];
  • (C) Array myArray;
  • (D) All of the above
πŸ’¬ Discuss
βœ… Correct Answer: (A) int[] myArray;
Explanation: In Java, a one-dimensional array is declared by specifying the type of elements followed by square brackets and then the array name. The correct syntax is:
Explanation by: Ritu Nagar
In Java, a one-dimensional array is declared by specifying the type of elements followed by square brackets and then the array name. The correct syntax is:

πŸ’¬ Discussion


πŸ“Š Question Analytics

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