go to previous page   go to home page   go to next page hear noise

What does the keyboard send to your program when you type the following:

1234

Answer:

The characters '1' , '2' , '3' , and '4' .


Characters In, Characters Out

characters flowing into a program

The keyboard sends character data to the computer, even when the characters look like numbers. And the program sends characters to the monitor, even when it has calculated a numerical result. (Actually, characters are not sent directly to the monitor. They are sent to the graphics card which converts them into a video signal which is displayed on the monitor.)

If your program does arithmetic, the input characters must be converted into one of the primitive numeric data types. This is done using a Scanner object. Then a result is calculated using arithmetic with the numeric data. The result must then converted into character data before it is sent to the monitor. This is done using a method of System.out.


QUESTION 5:

Have you already used System.out?