πŸ“Š JAVA
Q. Which of the following is the correct syntax for a for loop in Java?
  • (A) for (int i = 0; i < 10; i++) { System.out.println(“Hello”); }
  • (B) for (int i = 0; i < 10; i++) System.out.println(“Hello”);
  • (C) for (i = 0; i < 10; i++) { System.out.println(“Hello”); }
  • (D) for (int i = 0; i < 10) { System.out.println(“Hello”); }
πŸ’¬ Discuss
βœ… Correct Answer: (A) for (int i = 0; i < 10; i++) { System.out.println(“Hello”); }

Explanation: The for loop initializes a counter variable, tests a condition, and increments the counter variable on each iteration.

Explanation by: Deepak Sahoo
The for loop initializes a counter variable, tests a condition, and increments the counter variable on each iteration.

πŸ’¬ Discussion


πŸ“Š Question Analytics

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