adplus-dvertising
frame-decoration

Question

What is the value of "age" in the below Java program with a DO-WHILE loop?
int age=20;
do
{
  age++;
}while(age<20);
System.out.println(age);

a.

20

b.

21

c.

Compiler error

d.

None of the above

Posted under Java Programming

Answer: (b).21

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the value of "age" in the below Java program with a DO-WHILE loop?