πŸ“Š JAVA
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
πŸ’¬ Discuss
βœ… Correct Answer: (B) BRAZIL,CHILE,

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
455
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Ram Sharma
Publisher
πŸ“ˆ
87%
Success Rate