Home » Java Basics » exceptions

exceptions

java.io.EOFException – How to solve EOFException

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 ...

Read More »

java.lang.IllegalMonitorStateException – How to solve IllegalMonitorStateException

In this tutorial we will discuss about the IllegalMonitorStateException in Java. This exception, when thrown, indicates that the calling thread has attempted to wait on an object’s monitor, or has attempted to notify other threads that wait on an object’s monitor, without owning the specified monitor. The IllegalMonitorStateException extends the RuntimeException class and thus, belongs to those exceptions that can ...

Read More »

java.lang.StackOverflowError – How to solve StackOverflowError

In this tutorial, we will discuss how to solve the java.lang.stackoverflowerror – StackOverflowError in Java. This error is thrown to indicate that the application’s stack was exhausted, due to deep recursion. The StackOverflowError extends the VirtualMachineError class, which indicates that the JVM is broken, or it has run out of resources and cannot operate. Furthermore, the the VirtualMachineError extends the ...

Read More »

java.lang.InterruptedException – How to handle InterruptedException

In this example we will discuss about InterruptedException in Java. This exception is thrown when a thread is interrupted. The thread could be in either waiting, sleeping or running state and this exception can be thrown either before or during a thread’s activity. This exception extends the Exception class and thus, can be classified as a checked exception. Checked exceptions ...

Read More »

java.lang.UnsupportedOperationException – How to handle UnsupportedOperationException

In this tutorial we will discuss about UnsupportedOperationException in Java. This exception is thrown to indicate that the requested operation is not supported. This exception extends the RuntimeException class and thus, belongs to those exceptions that can be thrown during the operation of the Java Virtual Machine (JVM). It is an unchecked exception and thus, it does not need to ...

Read More »

java.util.NoSuchElementException – How to solve NoSuchElementException

In this tutorial we will discuss about NoSuchElementException in Java. This exception is thrown to indicate that there are no more elements in an enumeration. This exception extends the RuntimeException class and thus, belongs to those exceptions that can be thrown during the operation of the Java Virtual Machine (JVM). It is an unchecked exception and thus, it does not ...

Read More »

java.io.NotSerializableException – How to solve Not Serializable Exception

In this tutorial we will discuss about NotSerializableException in Java. The exception is thrown when an instance of a class must implement the Serializable interface. The exception is thrown by either the serialization runtime, or by the instance of the class. The argument of the NotSerializableException is the name of the class. The NotSerializableException class extends the ObjectStreamException class, which ...

Read More »