A

Admin • 828.03K Points
Coach

Q. What is the output of the Java program with Enhanced FOR loop below?

Code:
String countries[] = {"BRAZIL", "CHILE", "SYDNEY"};
int i=0;
for(String str: countries)
{
if(i<2)
;
else
break;
System.out.print(str + ",");
i++;
}
  • (A) BRAZIL,CHILE,SYDNEY,
  • (B) BRAZIL,CHILE,
  • (C) BRAZIL,
  • (D) Compiler error
  • Correct Answer - Option(B)
  • Views: 18
  • Filed under category Java
  • Hashtags:

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.