adplus-dvertising
frame-decoration

Question

What is the output of the below Java program?
String str="FOX";
int i=0;
while(i<str.length())
{
  System.out.print(str.charAt(i));
  i++;
}

a.

FFF

b.

FOX

c.

Compiler error

d.

None of the above

Posted under Java Programming

Answer: (b).FOX

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?