Continue statement Java example

For and continue statement in Java.

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


Comments are closed.



3,390 views