MODULE 2: I/O Operations Flashcards
In Java, I/O is based on ______
Streams
A _____ is a sequence of data elements that can be written sequentially
Stream
Used for reading data from a source
InputStream
Used for writing data to a destination
OutputStream
Used to read characters from the keyboard or any other standard input device
System.in or Standard Input System
Used to produce the result of a program on an output device
System.out or Standard output system
This is the easiest of all methods as this is similar to printf in C. It can also take multiple arguments
printf()
used to output all the error data that a program might throw
System.err or Standard error stream
They are commonly used for reading and writing text files
readers and writers
Streams are ______ while readers/writers are _______
byte-oriented, character-oriented
The Java API which provides a number of classes that you will use to work with files
import.java.io*;
What are the three method of getting an input:
- BufferedReader Class
- Scanner Class
- JOptionPane Class
Designed to read input from a source (System.in) and it provides methods that you can use to retrieve the input formatted as primitive values or strings
Scanner Method
Retrieves the next line of the data and returns it as a string
nextLine();
Allows you to quickly display a dialog box
JOptionPane class