title: nextInt() in java
body: <p>I have heard that nextInt() reads only the integers and ignores the \n at the end.
     So why does the following code runs successfully?   </p>
  
  <p>Why there is no error after we enter value of <strong>a</strong> since \n must remain in the buffer ,
      so use of nextInt() at b should give an error but it doesn't . Why?</p>
  
  <pre><code> import java.util.Scanner;
  
      public class useofScanner {
      public static void main(String[] args) {
          Scanner scanner =new Scanner(System.in);
          int a = scanner.nextInt();
          int b=scanner.nextInt();
          System.out.println(a+b);
      }
      }
  </code></pre>