Q. What is the output of the below Java program?

Code:
outer:
for(int i=1; i<=2;i++)
{
  inner:
  for(int j=1; j<=2;j++)
  {
    if(j>i)
      break inner;
    System.out.print(j +",");	
  }
}
  • (A) 1,1,1
  • (B) 1,2,2,
  • (C) 1,1,2,
  • (D) Compiler error
πŸ’¬ Discuss
βœ… Correct Answer: (C) 1,1,2,

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

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