Input & Output (I/O) and Exceptions
I/O and exceptions
Almost all non trivial programs need to do Input and Output. Examples of this are Word Processors that read document files, reading configuration files and network programs that read information from the internet. The programs you have seen so far have performed output to the console using the System.out.println method. This is fine for very small demonstration programs but for real world programs you need to know about the built in Java.io classes.
Because I/O is such a big subject I will cover just the basics here before returning to the subject later on. Java uses a concept of Streams to perform I/O. The idea of a stream is an analogy from real life such as with a streams in the real world. You use the Java I/O classes to create streams that can be used to read and write the contents of files.