πŸ“Š JAVA
Q. What is the output of the below Java program with WHILE, BREAK and CONTINUE?
Code:
int cnt=0;
while(true)
{
  if(cnt > 4)
    break;
  if(cnt==0)
  {	
    cnt++;
    continue;
  }
  System.out.print(cnt + ",");
  cnt++;
}
  • (A) 0,1,2,3,4,
  • (B) 1,2,3,4,
  • (C) 1,2,3,4
  • (D) Compiler error
πŸ’¬ Discuss
βœ… Correct Answer: (B) 1,2,3,4,

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
339
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Ram Sharma
Publisher
πŸ“ˆ
81%
Success Rate