- WatchJava I/O Tutorial # 1 - Introduction to Java Input /Output Stream Classes
- WatchJava I/O Tutorial #2 - FileInputStream and FileOutputStream Class with Example in Hindi and English
- WatchJava I/O Tutorial # 3 - Java Bufferedoutputstream and BufferedInputStream Class
- WatchJava I/O Tutorial # 4 - FileReader and FileWriter Class - Read and Write Characters to File
- WatchJava I/O Tutorial # 5 - How to Read Content from one File and Write in Another File
- WatchJava I/O Tutorial # 6 - ByteArrayOutputStream Class - How to Write into Multiple Streams
- WatchVarious Ways to Read Data / Content from Keyboard – Scanner, Console and BufferedReader Class
- WatchJava I/O Tutorial # 8 - PrintStream Class, Formatting using printf() method
Java I/O (Input and Output) is used to process the input and produce the output based on the input.
Java uses the concept of stream to make I/O operation fast. The java.io package contains all the classes required for input and output operations.
We can perform file handling in java by java IO API.
A stream is a sequence of data.In Java a stream is composed of bytes. It’s called a stream because it’s like a stream of water that continues to flow.
In java, 3 streams are created for us automatically. All these streams are attached with console.
1) System.out: standard output stream
2) System.in: standard input stream
3) System.err: standard error stream
Let’s see the code to print output and error message to the console.