Code example for Scanner

Methods: hasNextByte, nextByte, nextInt

0
		s = new Scanner("-123 -45");
		assertTrue(s.hasNextByte(8));
		assertEquals(-123, s.nextInt());
		assertEquals(-45, s.nextByte());
		 
		s = new Scanner("123 45");
		assertTrue(s.hasNextByte());
		s.close();
		try { 
			s.nextByte();
			fail("Should throw IllegalStateException");
		} catch (IllegalStateException e) {
			// expected 
		} 
    } 
    /** 
     * @throws IOException 
     * @tests java.util.Scanner#hasNextByte() 
     */ 
    public void test_hasNextByte() throws IOException { 
        s = new Scanner("123 126");