title: While Loop in program not working as expected and gets stuck
body: <p>I am a beginner and would appreciate some advice. I am writing a program where an airport worker and input plane information and then an airport user can print this information out. The program should keep asking the user which option should be selected until the user types 'x' to exit the program.</p>
  
  <p>Look at the while loop under the startAirplanePanel() method.</p>
  
  <p>Here is my UserInterface class:</p>
  
  <pre><code>import java.util.HashMap;
  import java.util.Scanner;
  import java.util.ArrayList;
  
  public class UserInterface {
      private Flights fly;
      private Scanner reader = new Scanner(System.in);  
  
      public UserInterface(){
          this.fly = new Flights();
          this.reader = reader;  
      }   
  
      public void startAirplanePanel(){        
  
          System.out.println("Airport panel");
          System.out.println("---------------");
          System.out.println();
          System.out.println();  
  
          while(true){
          System.out.println("Choose operation: ");
          System.out.println("[1] Add airplane");
          System.out.println("[2] Add flight");
          System.out.println("[x] Exit");
  
          String input = reader.nextLine();
                  if(input.equals("x")){
              break;
          }
  
          if(Integer.parseInt(input) == 1){
              addPlane();            
  
          } if(Integer.parseInt(input) == 2){
              addFlight();        
          }
      }        
  
          System.out.println("Flight service ");
              System.out.println("--------------");
              System.out.println();
              System.out.println();
  
           while(true){
  
              System.out.println("Choose operation: ");
              System.out.println("[1] Print planes");
              System.out.println("[2] Print flights");
              System.out.println("[3] Print plane info");
              System.out.println("[x] Print Quit");
  
              if(reader.equals("x")){
                  break;
              }
              if(Integer.parseInt(reader.nextLine()) == 1){
                  printPlane();
  
              }
              if(Integer.parseInt(reader.nextLine()) == 2){
                  printFlight();
              }
              if(Integer.parseInt(reader.nextLine()) == 3){
                  printPlaneInfo();
              }
  
  
          }
  
  }
  
      public void addPlane(){
          System.out.println("Give plane ID: ");
          String id = reader.nextLine();
          System.out.println("Give plane capacity: ");
          int capacity = Integer.parseInt(reader.nextLine());
  
          fly.planeMap(id,capacity);      
      }
  
      public void addFlight(){
          System.out.println("Give plane ID: ");
          String id = reader.nextLine();
          System.out.println("Give departure airport code: ");
          String departure = reader.nextLine();
          System.out.println("Give destination airport code: ");
          String destination = reader.nextLine();     
  
          fly.flightMap(id,departure,destination);
      }
  
      public void printPlane(){
  
          for(int i = 0; i &lt; fly.planeList().size(); i++){
              System.out.println(fly.planeList().get(i));
          }
      }
  
      public void printFlight(){
          for(int i = 0; i &lt; fly.flightList().size(); i++){
              System.out.println(fly.flightList().get(i));
          }       
      }
  
      public void printPlaneInfo(){
          System.out.print("Give plane ID: ");
          String id = reader.nextLine();
  
          System.out.println(id + " (" + fly.planeInfo(id) + ")");
      }
  
  }
  </code></pre>
  
  <p>Here is the code for the Flights class, which contains the methods:</p>
  
  <pre><code>
  import java.util.HashMap;
  
  import java.util.ArrayList;
  
  public class Flights {
  
      public HashMap&lt;String,Integer&gt; plane = new HashMap&lt;String,Integer&gt;();
      public HashMap&lt;String,String&gt; flight = new HashMap&lt;String,String&gt;();
  
      public Flights(){
  
          this.plane = plane;
          this.flight = flight;
  
      }
      public void planeMap(String id, Integer capacity){
          plane.put(id, capacity);
      }
  
      public void flightMap(String id, String departure, String destination){
          String flight1 = departure + "-" + destination;
          flight.put(id, flight1);
      }
  
      public ArrayList planeList(){
          ArrayList&lt;String&gt; keylist = new ArrayList&lt;String&gt;(plane.keySet());
          ArrayList&lt;Integer&gt; valuelist =  new ArrayList&lt;Integer&gt;(plane.values());
          ArrayList&lt;String&gt; newlist = new ArrayList&lt;String&gt;();
  
          for(int i = 0 ; i &lt; keylist.size() ; i++){
              newlist.add(keylist.get(i) + " (" + valuelist.get(i) + "ppl)");
          }
  
          return newlist;
      }
  
      public ArrayList flightList(){
          ArrayList&lt;String&gt; keylist = new ArrayList&lt;String&gt;(flight.keySet());
          ArrayList&lt;String&gt; valuelist =  new ArrayList&lt;String&gt;(flight.values());
          ArrayList&lt;String&gt; newlist = new ArrayList&lt;String&gt;();
  
          for(int i = 0; i &lt; keylist.size(); i++){
              newlist.add(keylist.get(i) + " (" + plane.containsKey(keylist.get(i)) + "ppl) " + "(" + valuelist.get(i) + ")");
          }        
  
          return newlist;
      }
  
      public int planeInfo(String id){
  
          if(plane.containsKey(id)){
          return plane.get(id);
      }
          return 0;
  }
  
  }
  </code></pre>
  
  <p>And here is the output:</p>
  
  <pre><code>Airport panel
  ---------------
  
  
  Choose operation: 
  [1] Add airplane
  [2] Add flight
  [x] Exit
  1
  Give plane ID: 
  GA-HAS
  Give plane capacity: 
  33
  Choose operation: 
  [1] Add airplane
  [2] Add flight
  [x] Exit
  x
  Flight service 
  --------------
  
  
  Choose operation: 
  [1] Print planes
  [2] Print flights
  [3] Print plane info
  [x] Print Quit
  1
  GA-HAS (33ppl)
  </code></pre>
  
  <p>The 2nd While loop should keep asking the user to choose an operation, for example, after typing in 1 and the system prints "GA-HAS (33ppl)", it should ask the user again for "Choose operation: [1] print planes ... [3] Print Quit]. But the while loop just stops there and I can't find the reason why.</p>
  
  <p>Please advise. Thank you!</p>