Używając warunku dla każdej pętli
public class Sample {
public static void main(String[] args) {
String names[] = { "Jasmine", "Lyka", "Marbie", "Soleen", "Tiny" };
for (String name : names) {
if (name.equalsIgnoreCase("Soleen")) {
System.out.println("We found " + name);
} else {
System.out.println(name);
}
}
}
}
Fernandez, Jasmine M.