From the course: Advanced Java Programming

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Understanding I/O in Java

Understanding I/O in Java - Java Tutorial

From the course: Advanced Java Programming

Start my 1-month free trial

Understanding I/O in Java

- [Instructor] Streams are a way of reading data or writing data. There are lots of different use cases for using streams and they are used more often than you might think. Even a simple Hello World application uses them. When you have a system.out.println statement, this is actually using an output stream to print out the text. They are also used for other things like reading and writing files in a program, taking user inputs from the console, and communicating through sockets. Streams represent a flow of data and a bit like real streams of water, they can only go in one direction. Output streams write out data and input streams read in data. If you wanted to have data going two ways, you would need two separate streams. There are two core abstract classes in Java Streams API, InputStream and OutputStream. As these are abstract classes, you can't instantiate them, but they each have several concrete implementations for handling different types of data. For example, concrete…

Contents