Friday, May 29, 2015

Continue Keyword

package info.employee;

public class ContinueKeyword {

public static void main(String[] args) {

String[] name = {"name1","name2","name3","name4","name5"};
for (String colName : name) {
if(colName == "name2"){ //it will leave name2 and print other as an output
continue;
}
System.out.println(colName);
}
}
}

No comments:

Post a Comment