Tino APCS

Simple I/O

Lesson Overview: The input and output of a program's data is usually referred to as I/O. There are many different ways that a Java program can perform I/O. In this lesson, we present some very simple ways to handle text input typed in at the keyboard as well as how to format text to the screen. The Advanced Placement subset does not require that you know how to use any specific input and output classes, only that you know how to use I/O in some manner. This curriculum will use the Scanner class and the printf() method provided with Java 1.5.

Lesson Vocab
CONVERSION

A piece of the formatting String that tells the Formatter class how to react to a message.

FLAGS

Special characters that give special properties to values passed in to the Formatter class.

PRECISION

A piece of the formatting String that tells the Formatter class the maximum number of characters to print out.

printf

A method of the System class that is capable of outputting formatted text.

Scanner

A java.util class that is capable of reading input.

System.in

The default input stream.

System.out

The default output stream.

WIDTH

A piece of the formatting String that tells the Formatter class the minimum number of characters to output.