A
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++;
}
int i=0;
for(String str: countries)
{
if(i<2)
;
else
break;
System.out.print(str + ",");
i++;
}
- Correct Answer - Option(B)
- Views: 18
- Filed under category Java
- Hashtags:
Discusssion
Login to discuss.