CHAPTER 10 — Input and Output

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to home page   hear noise   go to next page

revised: 9/26/98, 7/30/99, 01/17/00, 06/01/00, 01/16/06

CHAPTER 10 — Input and Output

This chapter discusses input and output for Java 25 LTS and above. Most programs input data, process it, and then output the results. This chapter discusses ways to input data from the keyboard and output results to the monitor. Later chapters will discuss input and output from disk files and other media.

Chapter Topics:

  • Input and Output Streams
  • The standard I/O streams
  • Scanner class
  • Exceptions
  • Converting character data to type int

Note: Some books show input done using classes written by the book's author. To use them, you must install a package from a CD or from a web site. This is OK. You can use these notes (with standard Java methods) along with your text without any interference.

QUESTION 1:

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

  • From an outside device into the program?
  • From the program out to some device?