title: For Loop Stalls on Second Time in Java
body: <p>I am trying to make some code that should keep track of a win/loss ratio. I have a for loop that checks if a name is present in a separate variable, this works but when I try to do it again it stalls.</p>
  
  <pre><code>System.out.println("\nEnter Name 1");
  scan.nextLine();
  String name1 = scan.nextLine();
  for (int i = 0; i &lt; numPlayers; i++) {
      if (name1.equals(players[i].name)) {
          players[i].win++;
          break;
      }
  }
  System.out.println("\nEnter Name 2");
  scan.nextLine();
  String name2 = scan.nextLine();
  for (int i = 0; i &lt; numPlayers; i++) {
      if (name2.equals(players[i].name)) {
          players[i].loss++;
          break;
      }
  }
  </code></pre>
  
  <p>After the code it should go back to a while loop, but it just stalls instead. If I comment out the name 2 part, the code works, but I need both parts.</p>
  
  <p>Edit 1:
  Heres the whole code</p>
  
  <pre><code>public class Counter {
  
      @SuppressWarnings("resource")
      public static void main(String[] args) {
  
          int intTemp;
          String stringTemp;
  
          int keepGoing = 1;
          int numPlayers = 0;
          Player[] players = new Player[999];
  
          Scanner scan = new Scanner(System.in);
          System.out.println("Melee Score Tracker");
  
          while (keepGoing == 1) {
              System.out.println("\nPrint Scores\t1\nNew Match\t2\nNew Player\t3\nExit\t\t4");
              intTemp = scan.nextInt();
  
              // Print Scores
              if (intTemp == 1) {
  
                  intTemp = 0;
                  System.out.print("\n");
                  for (int i = 0; i &lt; numPlayers; i++) {
                      players[i].print();
                  }
  
              }
  
              // New Match
              if (intTemp == 2) {
  
                  intTemp = 0;
                  System.out.println("\nEnter Name 1");
                  scan.nextLine();
                  String name1 = scan.nextLine();
                  for (int i = 0; i &lt; numPlayers; i++) {
                      if (name1.equals(players[i].name)) {
                          players[i].win++;
                          break;
                      }
                  }
                  System.out.println("\nEnter Name 2");
                  scan.nextLine();
                  String name2 = scan.nextLine();
                  for (int i = 0; i &lt; numPlayers; i++) {
                      if (name2.equals(players[i].name)) {
                          players[i].loss++;
                          break;
                      }
                  }
              }
  
              // New Player
              if (intTemp == 3) {
  
                  intTemp = 0;
                  System.out.println("\nWhat's the player's name?");
                  scan.nextLine();
                  stringTemp = scan.nextLine();
                  players[numPlayers] = new Player();
                  players[numPlayers].name = stringTemp;
                  numPlayers++;
                  System.out.println(numPlayers);
  
              }
  
              // Exit
              if (intTemp == 4) {
  
                  System.exit(0);
  
              }
          }
  
      }
  }
  </code></pre>