In this tutorial we will discuss about the EOFException in Java. This exception indicates the the end of file (EOF), or the end of stream has been reached unexpectedly. Also, this exception is mainly used by DataInputStreams, in order to signal the end of stream. However, notice that other input operations may return a special value upon the end of a stream, instead of throwing an EOFException. The EOFException class extends the IOException class, which is the general class of exceptions produced by failed, or interrupted I/O operations. Moreover, it implements the Serializable interface. Also, it is defined as a checked exception and thus, it must be declared in a method, or a constructor’s throws clause.