adplus-dvertising
frame-decoration

Question

What is the output of the below Java code with a FOR loop?
for(int i=1; i<5; i++)
{
  System.out.print(i +",");
}

a.

1,2,3,4,

b.

1,2,3,4

c.

1,2,3,4,5,

d.

1,2,3,4,5

Posted under Java Programming

Answer: (a).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 with a FOR loop?