R

Ram Sharma • 193.86K Points
Coach

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
  • Correct Answer - Option(C)
  • Views: 189
  • Filed under category JAVA

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.


Question analytics