java.util.Scanner
A simple text scanner that can parse primitive types and strings using regular expressions.
A Scanner breaks its input into tokens using a delimiter pattern, which by default matches whitespace.
Some methods of Scanner class.
hasNextDouble(): This method returns true if the next token in this scanner's input can be interpreted as a double value.
hasNextFloat(): This method returns true if the next token in this scanner's input can be interpreted as a float value.
hasNextInt(): This method returns true if the next token in this scanner's input can be interpreted as an int value in the default radix.
hasNextInt(int): This method returns true if the next token in this scanner's input can be interpreted as an int value in the specified radix.
hasNextLine(): This method returns true if there is another line in the input of this scanner.
hasNextLong(): This method returns true if the next token in this scanner's input can be interpreted as a long value in the default radix.
hasNextLong(int): This method returns true if the next token in this scanner's input can be interpreted as a long value in the specified radix.
hasNextShort(): This method returns true if the next token in this scanner's input can be interpreted as a short value in the default radix.
hasNextShort(int): This method returns true if the next token in this scanner's input can be interpreted as a short value in the specified radix.
ioException(): This method returns the IOException last thrown by this Scanner's underlying Readable.
locale(): This method returns this scanner's locale.
match(): This method returns the match result of the last scanning operation performed by this scanner.
next(): This method finds and returns the next complete token from this scanner.
next(Pattern): This method returns the next token if it matches the specified pattern.
next(String): This method returns the next token if it matches the pattern constructed from the specified string.
nextBigDecimal(): This method scans the next token of the input as a BigDecimal.
nextBigInteger(): This method scans the next token of the input as a BigInteger.
nextBigInteger(int): This method scans the next token of the input as a BigInteger according to the specified radix.
nextBoolean(): This method scans the next token of the input into a boolean value and returns that value.
nextByte(): This method scans the next token of the input as a byte.
Some more methods of Scanner class -I
Some more methods of Scanner class -III
No comments:
Post a Comment