Java Reference
In-Depth Information
Scanner (InputStream source)
Scanner (File source)
Scanner (String source)
Constructors: sets up the new scanner to scan values from the specified source.
String next()
Returns the next input token as a character string.
String nextLine()
Returns all input remaining on the current line as a character string.
boolean
nextBoolean()
byte
nextByte()
double
nextDouble()
float
nextFloat()
int
nextInt()
long
nextLong()
short
nextShort()
Returns the next input token as the indicated type. Throws
InputMismatchException
if the next token is inconsistent with the type.
boolean
hasNext()
Returns true if the scanner has another token in its input.
Scanner useDelimiter (String pattern)
Scanner useDelimiter (Pattern pattern)
Sets the scanner's delimiting pattern.
Pattern delimiter()
Returns the pattern the scanner is currently using to match delimiters.
String findInLine (String pattern)
String findInLine (Pattern pattern)
Attempts to find the next occurrence of the specified pattern, ignoring delimiters.
FIGURE 2.7
Some methods of the
Scanner
class
Search WWH ::
Custom Search