Skip to content

Tag Archives: Java-Exception Handling

In order to learn how to avoid an error, we must first understand the error. NullPointerException NullPointerException is a RuntimeException. In Java, a special null… Read More
An Exception is an unwanted or unexpected event, which occurs during the execution of a program i.e at run-time, that disrupts the normal flow of… Read More
What is an Exception?  An exception is an “unwanted or unexpected event”, which occurs during the execution of the program i.e, at run-time, that disrupts… Read More
Getting name of currently executing method is useful for handling exceptions and debugging purposes. Below are different methods to get currently executing method : Using… Read More
The addSuppressed?(Throwable exception) method of a Throwable class used to append the exception to the exceptions that were suppressed in order to deliver this exception.… Read More
The setStackTrace(StackTraceElement[] stackTrace) method of Throwable class is used to Set the stack trace elements to this throwable object and this stack trace will be… Read More
The toString() method of Java.lang.Throwable class used to return a String representation of this Throwable which consists of the name of the class of this… Read More
printStackTrace() The printStackTrace() method of Java.lang.Throwable class used to print this Throwable along with other details like class name and line number where the exception… Read More
The initCause() method of Throwable class is used to initialize the cause of the this Throwable with the specified cause passed as a parameter to… Read More
The getStackTrace() method of Throwable class used to return an array of stack trace elements which is the stack trace information printed by printStackTrace(). In… Read More
The getSuppressed() method of Throwable class used to return an array containing all of the exceptions that were suppressed to deliver this exception typically this… Read More
The getCause() method of Throwable class is the inbuilt method used to return the cause of this throwable or null if cause can’t be determined… Read More
The getLocalizedMessage() method of Throwable class is used to get a locale-specific description of the Throwable object when an Exception Occurred. It helps us to… Read More
The getMessage() method of Throwable class is used to return a detailed message of the Throwable object which can also be null. One can use… Read More
In Java, we can use a try block within a try block. Each time a try statement is entered, the context of that exception is… Read More

Start Your Coding Journey Now!