0

少し助けが必要です。配列を調べて、入力された目的地と同じすべての目的地を見つけたいのですが、これは 1 しか出力しません。何か提案はありますか? ありがとうございました。

for (int x = 0; x<40;x++){
    String flight;

    Scanner input = new Scanner (System.in);
    System.out.println("Enter Flight destination to find: ") ;
    flight = input.next();
    if (plane[x].destination.equals(flight)){
        System.out.println("Found destination! " + "\t" + "at array  " + x);
        System.out.println(plane[x].flightid + "\t" + plane[x].origin + "\t" + plane[x].destination);
        break;   
    }
}
4

2 に答える 2