The Labeled continue statement Java example

The Labeled continue statement as goto Java example.

public class MainClass {
	public static void main(String[] arg) {
		String[] arrayOfString = { "Hello", "people", "hello", "world!" };
		OuterLoop: for (int e = 0; e < 4; e++) {
			for (int i = 0; i < arrayOfString.length; i++) {
				if (arrayOfString[i].equals("hello"))
					continue OuterLoop;
				System.out.println(arrayOfString[i]);
			}
		}
	}
}
/*
Hello
people
Hello
people
Hello
people
Hello
people
*/
This entry was posted in Android Examples Code and tagged , , , , , . Bookmark the permalink.


Comments are closed.

2,348 views