Code example for Scanner

Methods: hasNextIntnextInt

0
        inputScanner = new Scanner(System.in);
    } 
     
    public int nextInt() 
    { 
        if ( inputScanner.hasNextInt() )
            return inputScanner.nextInt();
        else { 
            inputScanner.skip(".*\n");
            return -1; 
        } 
    } 
     
    public void howManySticksMsg() 
    { 
        System.out.print("How many sticks? ");
    } 
     
    public void sticksLeftMsg(int left)
    {