Q. What will be the output of the following program?

Code:
public class Test {  
public static void main(String[] args) {  
    int count = 1;  
    while (count <= 15) {  
    System.out.println(count % 2 == 1 ? "***" : "+++++");  
    ++count;  
        }      // end while  
    }       // end main   
 }
  • (A) 15 times ***
  • (B) 15 times +++++
  • (C) 8 times *** and 7 times +++++
  • (D) Both will print only once
πŸ’¬ Discuss
βœ… Correct Answer: (C) 8 times *** and 7 times +++++

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
322
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Mahesh Chandra
Publisher
πŸ“ˆ
97%
Success Rate