The InputStream class of the java.io package is an abstract superclass that represents an input stream of bytes. Since InputStream is an abstract class, it is not useful by itself. However, its subclasses can be used to read data. In order to use the functionality of InputStream, we can use its subclasses. Some of them are:
In order to create an InputStream, we must import the java.io.InputStream package first. Once we import the package, here is how we can create the input stream.
Here, we have created an input stream using FileInputStream. It is because InputStream is an abstract class. Hence we cannot create an object of InputStream.