title: ArrayList Scanner input help Java
body: <p>I am trying to write a code where you sort a given list of numbers, and I'm trying to do so using ArrayList. I am using a while loop to allow for repeated inputs. This is my code:</p>
  
  <pre><code>import java.util.Scanner; 
  import java.util.ArrayList;
  
  public class sortinggg {
  
      public static Scanner keyboard = new Scanner(System.in);
      public static ArrayList&lt;Integer&gt; number = new ArrayList&lt;Integer&gt;();
  
      public static void main (String [] args) {
  
          int count= 0;
  
          System.out.println("Enter your numbers.");
  
          while (keyboard.hasNextInt()); {
              number.add(keyboard.nextInt()); 
          }
  </code></pre>
  
  <p>The integer count is irrelevant right now, as I only use it when I am sorting the list.</p>
  
  <p>The problem is that after I input my numbers, even if I type in a string (for example), the program doesn't move on to the next line of code. Am i missing anything here? </p>
  
  <p>P.S. I tired looking up questions that have been asked previously on this topic, but none of the solutions suggested worked for me.Thank you for your help in advance!</p>