If you are working with the File APIs in Java, it is common that you would encounter the FileNotFoundException. This is a subclass of IOException. This Java exception is thrown by the classes FileInputStream, FileOutputStream, and RandomAccessFile. These classes trying to access a file in the system for the purposes of reading or writing into …
Java Exceptions
NullPointerException in Java
One of the most common and nightmare for the Java programmers are getting the NullPointerException while running the Java application. This exception is defined at the “java.lang” package and the purpose of the exception is to detect if an object is used without any content. Here you must understand the difference between Reference and Object. …
java.util.ConcurrentModificationException
ConcurrentModificationException is thrown when two threads are updating the same element on same time. This issue occurs often in the multithreaded environment. However, this also can occur in the single thread environment where same application running the multiple threads which updates the same object. Look at this example which throws ConcurrentModificationException while updating the value …
java.lang.ArrayIndexOutOfBoundsException
One of the feature in the Java programming language is usage of arrays. The advantage of using arrays is to store the large number of values and retrieve them using the index values. Each array is treated as an object itself. Each array has the fixed number of elements and it will not be changed …
java.lang.NoSuchMethodError
NoSuchMethodError is thrown when a Java class trying to invoke a method from another class which is not exist. Typically, this error has to be caught at the compile time. However, this error also thrown at run time when class has incompatibly changed. This error is sub class of java.lang.IncompatibleClassChangeError. This class inherited from the …