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

When a computer program does an input operation, in which direction does the data flow?

Answer:

From an outside device into the program.

I/O

Input and output are so common that an abbreviation has been created: I/O (pronounced eye-oh). I/O operations are very complicated, both at the software level and at the electronic level. Part of the problem is that the way in which data is organized outside the computer is different from the way it is organized inside the computer. Lots of computation is needed to convert data between its various forms. Luckily, most of the complication has been hidden inside methods that your program can use.

These notes use methods of the class java.util.Scanner for doing input. Scanner is new to Java 5.0. Scanner is not part of the fundamental Java language, but is part of a package, java.util, that you can include in your program. A package is a collection of classes which may used in your program. Think of a package as a tool box and the classes within it as tools. Different programs need different tools and include different packages.

It may seem odd to you that Java itself does not have I/O built into it. The reason for this is that there are very many types of I/O, and a language that has all of them built in would be large and cumbersome. A language used for professional software development such as Java (or C or C++ or any of several others) allows the programmer to pick the right I/O package for the job.

QUESTION 2:

Your automobile has a computer that controls the motor as it monitors data from dozens of sensors. Is this computer doing input and output?