Java Reference
In-Depth Information
Display 10.6
Methods in the Class
Scanner
(part 3 of 4)
public boolean
hasNextDouble()
Returns
true
if the next token is a well-formed string representation of a
double
; otherwise
returns false.
Throws an
IllegalStateException
if the
Scanner
stream is closed.
public float
nextFloat()
Returns the next token as a
float
, provided the next token is a well-formed string representation
of a
float
.
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
float
.
Throws an
IllegalStateException
if the
Scanner
stream is closed.
public boolean
hasNextFloat()
Returns
true
if the next token is a well-formed string representation of a
float
; otherwise
returns
false
.
Throws an
IllegalStateException
if the
Scanner
stream is closed.
public
String next()
Returns the next token.
Throws a
NoSuchElementException
if there are no more tokens.
Throws an
IllegalStateException
if the
Scanner
stream is closed.
public boolean
hasNext()
Returns
true
if there is another token. May wait for a next token to enter the stream.
Throws an
IllegalStateException
if the
Scanner
stream is closed.
public boolean
nextBoolean()
Returns the next token as a
boolean
value, provided the next token is a well-formed string
representation of a
boolean
.
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
boolean
value.
Throws an
IllegalStateException
if the
Scanner
stream is closed.
public boolean
hasNextBoolean()
Returns
true
if the next token is a well-formed string representation of a
boolean
value; otherwise
returns
false
.
Throws an
IllegalStateException
if the
Scanner
stream is closed.
(continued)