Input output programming in Java

Input/output programming involves reading and writing to files, sockets, console etc.

For example —

System.in is a standard input stream (Keyboard) and System.out is the standard output stream (console).

Below image shows how a typical Java application reads data from InputStream of file, console or socket and writes to OutputStream of other file, socket or console.

Inputs

Reading and Writing to Streams

Below images show important classes and interfaces required for I/O programming in Java.

Inputstream

InputStream Hierarchy

 

Outputstream in Java

OutputStream Hierarchy

 

 

You may also like...