Have you already used System.out
?
Yes, System.out.println( "Some string" )
sends characters to the output stream.
Here is a picture of a Java program doing character input
and output.
In this picture, the white box represents the entire program.
The program has imported Scanner
for use with input,
and has imported System.out
for use with output.
The nextLine()
method of Scanner
reads a
line of character data from the keyboard.
The characters go into a String
object.
An assignment statment puts a reference to the object in the reference variable
inData
.
To output the characters to the monitor,
the program uses the println()
method of System.out
.
Do you suppose that a Scanner
object has more
methods than the one method in this picture?