KnowledgeBoat Logo
|

Computer Applications

What will be the output of the following program segment?

int a = 100; 
while(false)
{
    if(a < 50)
        break; 
    a = a - 10;
}
System.out.println(a);

Java Iterative Stmts

11 Likes

Answer

Output
100
Explanation

Since the condition of while loop is false, the body of while loop will not execute. The print statement following the loop will execute and print 100 on the screen.

Answered By

7 Likes


Related Questions