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++;
}
β
Correct Answer: (B)
1,2,3,4,