I/O
This chapter covers input and output (I/O) in more detail than the quickstart chapter. It will skip the simplified I/O scripts we use in jshell to get started, but other information will be repeated as appropriate to make this a more useful reference.
Terms
Input refers to information fed into a system. This includes text you type into a messaging app, button presses on a game controller, and tapping on the screen of a smartphone.
Output refers to information produced by a system. This includes text and images displayed on your monitor, a file saved to your hard drive, and sounds played through earbuds or speakers.
I/O Devices
There are many physical I/O devices that can be used with a computer. Below are a few examples.
Input Devices:
- Keyboard
- Mouse
- Touchscreen
- Gamepad
- Camera
- Microphone
- Scanner
Output Devices:
- Monitor
- Speaker
- Headphones/earbuds
- Printer
- Gamepad (some have speakers, vibration, and lights)
Program I/O
This chapter focuses primarily on program I/O: information provided to and produced by the programs we write. There are many forms of I/O used by programs; here are a few examples:
- Standard I/O: standard I/O refers to input received through the user typing on a terminal and output produced by printing to the terminal.
- Input Devices: programs can respond to input from devices such as keyboards, mice, and gamepads.
- Graphics: programs can draw shapes, text, and images in windows and display these on the monitor or other display devices.
- Files: programs can get input by reading files on storage devices such as hard drives, solid-state drives, usb flash drives, and DVDs, and they can produce output by writing to files on these devices.
- The Internet: programs can use the internet to send information to and receive information from other computers.
The quickstart section covers some simplified functions for standard I/O. This chapter will cover functions and classes typically used to interact with standard I/O. Later we'll return to this chapter to learn about file I/O.