Code example for Scanner

Methods: nextIntuseLocale

0
        } catch (InputMismatchException e) {
            // Expected 
        } 
 
        // If the number is out of range 
        s = new Scanner("123456789123456789123456789123456789");
        try { 
            s.nextInt(10);
            fail("Should throw InputMismatchException");
        } catch (InputMismatchException e) {
            // Expected 
        } 
 
        /* 
         * Different locale can only recognize corresponding locale sensitive 
         * string. ',' is used in many locales as group separator. 
         */ 
        s = new Scanner("23,456 23,456");
        s.useLocale(Locale.GERMANY);
        try { 
Connect your IDE to all the code out there  Get Codota for Java