I have this simple 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
    }
  }
I don't know why I always receive this Exception, when code run to ex2.
 
     
     
    