Section 11.1. Introduction


[Page 512]

11.1. Introduction

We have been using input and output in our programs since the very first chapters of the book. In this chapter we will take a closer look at Java's input and output elements.

Input refers to information or data read from some external source into a running program. We introduced you to working with input in Chapter 4, when we developed the KeyboardReader class with methods for reading data from the keyboard into the console window. The chapter also discussed reading data from the keyboard into a JTextField in a GUI interface, as well as reading data from a text file using methods in the Scanner class.

input and output


Output refers to information or data written from a running program to some external destination. Up to this point, whenever our programs have produced output, it has been sent to either the Java console, a text area, or some other GUI component. These destinations are transitory, in the sense that they reside in the computer's primary memory and exist only so long as the program is running.

A file is a collection of data stored on a disk or on some other relatively permanent storage medium. A file's existence does not depend on a running program. In this chapter, we will learn how to create files and how to perform input and output operations on their data using the Java classes designed specifically for this purpose. Methods from these classes allow us to write data to files and provide greater flexibility in the way we read data from files than the Scanner class offers.




Java, Java, Java(c) Object-Orienting Problem Solving
Java, Java, Java, Object-Oriented Problem Solving (3rd Edition)
ISBN: 0131474340
EAN: 2147483647
Year: 2005
Pages: 275

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net