Verwenden Sie für jede Schleife für die Suche in Array
import java.util.Scanner;
public class Sample {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String names[] = { "Jasmine", "Lyka", "Marbie", "Soleen", "Tiny" };
System.out.print("Enter name to search:");
String search = input.nextLine();
for (String name : names) {
if (name.equalsIgnoreCase(search)) {
System.out.println("We found " + name);
break;
} else {
System.out.println(name);
}
}
input.close();
}
}
Fernandez, Jasmine M.