Code example for Scanner

Methods: hasNextInt, hasNextShort, nextInt, nextShort

0
		assertEquals(-123, s.nextInt());
		assertEquals(-456, s.nextShort());
		assertTrue(s.hasNextInt(16));
		assertEquals(-789, s.nextShort());
		 
		s = new Scanner("123 456");
		assertTrue(s.hasNextShort());
		s.close();
		try { 
			s.nextShort();
			fail("Should throw IllegalStateException");
		} catch (IllegalStateException e) {
			// expected 
		} 
	} 
     
    /** 
	 * @throws IOException 
	 * @tests java.util.Scanner#hasNextLong(int) 
	 */ 
    public void test_hasNextLongI() throws IOException {