title: Java: always receive NoSuchElementException when use Scanner
body: <p>I have this simple code:</p>
  
  <pre><code>    public class Example {
         public Example() {
            Scanner scanner = new Scanner(System.in);
            int row = scanner.nextInt();   // exception at this line
            scanner.close();
         }
  
      public static void main(String[] args) {
          Example ex1 = new Example();   // this line successfully operate
          Example ex2 = new Example();   // exception : no such element exception at above line
      }
    }
  </code></pre>
  
  <p>I don't know why I always receive this Exception, when code run to ex2.</p>