Character Input and Output in Java
An Introduction |
Prof. David Bernstein
|
Computer Science Department |
bernstdh@jmu.edu |
String
objectsScanner
(cont.)int
is the
only thing on a line), you will need to
invoke nextLine()
immediately after
invoking one of these methodsBufferedReader
BufferedReader
from an
InputStreamReader
or FileReader
readLine()
method (which
throws IOException
)String
object into parts (i.e., tokenize)split()
:
StringTokenizer
:
nextToken()
nextToken()
throws
NoSuchElementException
which can be used to handle
situations with too few fields
while
Loop
do-while
Loop
File
classFile
Objects:
java.io.IOException
(they
actually throw a more "specific" exception -- we'll learn
what this means later)
BufferedReader
Scanner