adplus-dvertising
frame-decoration

Question

What is the output of the below Java code?
int score=1;
for(; true; score++)
{
  System.out.print(score +",");
  if(score > 3)
    break;
}

a.

1,2,3,

b.

1,2,3

c.

1,2,3,4,

d.

1,2,3,4

Posted under Java Programming

Answer: (c).1,2,3,4,

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 code?