adplus-dvertising
frame-decoration

Question

What is the output of the below Java program?
String str[] = {"A","B","C"};
int i=0;
do
{
  if(i>= str.length)
    break;
  System.out.print(str[i] + ",");
  i++;
}while(true);

a.

A,B,C,

b.

A,B,C

c.

Runtime Exception with Index Of Bounds Exception

d.

Compiler error

Posted under Java Programming

Answer: (a).A,B,C,

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?