title: Scanner class' hasNext() on infinite loop
body: <p>I'm trying to write code that uses the Scanner class to get input from the user. But hasNext(), hasNextInt(), and hasNextLine() all run into infinite loops every time.</p>
  
  <pre><code>public static void getInput(ArrayList&lt;Double&gt; arr){
  
         Scanner input = new Scanner(System.in);
         String data = "";
         String init;
         while(input.hasNextLine()){
             init = input.nextLine();
             data += init;
         }
         .
         .
         .
     }
  </code></pre>