adplus-dvertising
frame-decoration

Question

What is the output of the below Java program?
int a=1;
while(a<4)
{
  System.out.print(a + " ");
  a++;
}

a.

1 2 3 4

b.

1 2 3

c.

6

d.

Compiler error

Posted under Java Programming

Answer: (b).1 2 3

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 output of the below Java program?