Here is a code:

public static void doIt(String String) { //1
  int i = 10;
  i : for (int k = 0 ; k< 10; k++) { //2
    System.out.println( String + i); //3
    if( k*k > 10) continue i; //4 
  }
}
Explanation
String is not a keyword, so it can be used as an identifier. i before for loop is a label that is used in continue statement. It can share the same name with a variable.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes