πŸ“Š JAVA
Q. What is the output of the following code?
Code:
int[] myArray = {1, 2, 3, 4, 5};
for (int i = 0; i < myArray.length; i++) {
System.out.print(myArray[i] + ” “);
}
  • (A) 1 2 3 4 5
  • (B) 5 4 3 2 1
  • (C) 1,2,3,4,5
  • (D) 5,4,3,2,1
πŸ’¬ Discuss
βœ… Correct Answer: (A) 1 2 3 4 5

Explanation: The for loop iterates through each element of the array and prints its value, followed by a space.

Explanation by: Deepak Sahoo
The for loop iterates through each element of the array and prints its value, followed by a space.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
269
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Deepak Sahoo
Publisher
πŸ“ˆ
83%
Success Rate