Java Reference
In-Depth Information
public boolean
hasNextInt()
Returns
true
if the next token is a well-formed string representation of an
int
; otherwise
returns
false.
Throws:
IllegalStateException
if the
Scanner
stream is closed.
public long
nextLong()
Returns the next token as a
long
, provided the next token is a well-formed string representation
of a
long.
Throws:
NoSuchElementException
if there are no more tokens.
InputMismatchException
if the next token is not a well-formed string representation of
a
long.
IllegalStateException
if the
Scanner
stream is closed.
public boolean
hasNextLong()
Returns
true
if the next token is a well-formed string representation of a
long
; otherwise
returns
false.
Throws:
IllegalStateException
if the
Scanner
stream is closed.
public byte
nextByte()
Returns the next token as a
byte
, provided the next token is a well-formed string representation
of a
byte.
Throws:
NoSuchElementException
if there are no more tokens.
InputMismatchException
if the next token is not a well-formed string representation of a
byte.
IllegalStateException
if the
Scanner
stream is closed.
public boolean
hasNextByte()
Returns
true
if the next token is a well-formed string representation of a
byte
; otherwise
returns
false.
Throws:
IllegalStateException
if the
Scanner
stream is closed.
public short
nextShort()
Returns the next token as a
short
, provided the next token is a well-formed string representa-
tion of a
short.
Throws:
NoSuchElementException
if there are no more tokens.
InputMismatchException
if the next token is not a well-formed string representation of a
short.
IllegalStateException
if the
Scanner
stream is closed.