title: Why last element of input is missing in Scanner?
body: <p>I use IntelliJ and I have a problem with a Scanner. Last element from the input is missing in the output. Any ideas? </p>
  
  <p>Input: <code>1, 2, 3</code><br>
  Output: <code>1, 2</code> </p>
  
  <pre><code>public static void main(String[] args) {
      Scanner sc = new Scanner(System.in).useDelimiter(", ");
      while (sc.hasNext()) {
          System.out.print(sc.nextInt());
      }
  }
  </code></pre>