Java Reference
In-Depth Information
Display 10.6
Methods in the Class
Scanner
(part 2 of 4)
public boolean
hasNextLong()
Returns
true
if the next token is a well-formed string representation of a
long
; otherwise
returns
false
.
Throws an
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 a
NoSuchElementException
if there are no more tokens.
Throws an
InputMismatchException
if the next token is not a well-formed string representation
of a
byte
.
Throws an
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 an
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 representation
of a
short
.
Throws a
NoSuchElementException
if there are no more tokens.
Throws an
InputMismatchException
if the next token is not a well-formed string representation
of a
short
.
Throws an
IllegalStateException
if the
Scanner
stream is closed.
public boolean
hasNextShort()
Returns
true
if the next token is a well-formed string representation of a
short
; otherwise
returns
false
.
Throws an
IllegalStateException
if the
Scanner
stream is closed.
public double
nextDouble()
Returns the next token as a
double
, provided the next token is a well-formed string representation
of a
double
.
Throws a
NoSuchElementException
if there are no more tokens.
Throws an
InputMismatchException
if the next token is not a well-formed string representation
of a
double
.
Throws an
IllegalStateException
if the
Scanner
stream is closed.