title: Why loop break before when I type something second time
body: <p>I want to break loop when I send nothing to input. But when I type something to input at <code>nameS</code> second time loop break by itself although the input wasn't empty.</p>
  
  <pre><code>public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      while(true) {
          System.out.print("Name: ");
          String nameS = sc.nextLine();
          if(nameS.isEmpty()) {
              break;
          }
          System.out.print("Student number: ");
          int numberS = sc.nextInt();
      } 
  }
  </code></pre>