title: Scanner class skipping over code
body: <p>So I have a method that isn't that complicated at all, but it seems to be skipping over 2 lines of code in a while loop that I have. I have tried a Do-while and a normal while loop, neither of which help. Here is the code:</p>
  
  <pre><code>        do
      {
          System.out.println("Enter a building material that you would like to add :: ");
          String first = keyboard.nextLine();
          System.out.println("How many of that material would you like to add ::");
          int second = keyboard.nextInt();
          int i = (int)item.getID(first);
  
              //long section of code here. It's not necessary
  
          System.out.println("");
          System.out.println("Lumber - " + lumber);
          System.out.println("Plywood - " + plywood);
          System.out.println("Cinderblocks - " + cinder);
          System.out.println("Mortar - " + mortar);
          System.out.println("Tank Traps - " + tanktrap);
          System.out.println("Metal Poles - " + metalpole);
          System.out.println("");
  
          System.out.println("Would you like to add more materials? (yes / no) :: ");
          String response = keyboard.next();
          if(response.equalsIgnoreCase("yes"))
          {
              wantsNext = true;
          }else{
              wantsNext = false;
          }
  
  
      }while(wantsNext);
  </code></pre>
  
  <p>The Output of this is as follows :</p>
  
  <pre><code>Welcome to OGx_Killer's Epoch Building Supplies Calculator
  Enter a building material that you would like to add :: 
  cinderblock wall
  How many of that material would you like to add ::
  10
  
  Lumber - 0
  Plywood - 0
  Cinderblocks - 70
  Mortar - 20
  Tank Traps - 0
  Metal Poles - 0
  
  Would you like to add more materials? (yes / no) :: 
  yes
  Enter a building material that you would like to add :: 
  How many of that material would you like to add ::
  </code></pre>
  
  <p>As you can see, the second time around in the loop, it skips over the first input, leaving the second input to be answered, rendering the loop useless. Any help would be greatly appreciated. I have a feeling that it is a problem with the scanner method that I am using. It probably needs to be something other than keyboard.nextLine(). Many thanks!</p>