Exceptions In Java

IllegalThreadStateException in Java

IllegalThreadStateException in Java

Class IllegalThreadStateException in Java IllegalThreadStateException is thrown from code to indicate that the thread is not in an appropriate state for the required or requested operation. The call to sleep() method is enclosed with a try block followed by a catch block. The sleep() method may throw an exception, which needs to be caught and …

IllegalThreadStateException in Java Read More »

Class Class in Java

Class MalformedURLException in Java

Introduction to Class MalformedURLException in Java MalformedURLException is common exception classes in java when working with a network and is thrown from an application to indicate that a malformed URL has occurred. It happens when the built-in class URL gets an invalid URL. In a client-server architecture, while connecting, if we use java.net.URL class object …

Class MalformedURLException in Java Read More »

Class Class in Java

ArithmeticException in Java

Class ArithmeticException in Java: ArithmeticException is thrown to indicate that an exceptional arithmetic condition has occurred. Example divide by zero. The class structure is as follows: public class java.lang.ArithmeticException extends java.lang.RuntimeException{ //constructor public ArithmeticException(); //constructs an empty ArithmeticException object that is an object with no message specified. public ArithmeticException(String message); //constructs an ArithmeticException object with …

ArithmeticException in Java Read More »

Class Class in Java

Class UnsupportedFlavorException in java

Class UnsupportedFlavorException in java An exception of this type signals that a Transferable object could not provide data in the requested format.This exception is thrown from Transferable.getTransferData(DataFlavor) to indicate that the DataFlavor requested is not available. The structure of the class UnsupportedFlavorException is given by public class java.awt.datatransfer.UnsupportedFlavorException extends java.lang.Exception{ // Public Constructor public UnsupportedFlavorException(DataFlavor …

Class UnsupportedFlavorException in java Read More »

Class Class in Java

Class IllegalComponentStateException in Java

Class IllegalComponentStateException in Java An Exception indicating that a Component was not in an appropriate state to perform requested action. IllegalComponentStateException is a child class of RunTimeException. Hence coders do not need to bother to use a try-catch block. Catching this exception is not a good practice. IllegalComponentStateExceptio is also child class of IllegalStateException. This …

Class IllegalComponentStateException in Java Read More »

Class Class in Java

Class IndexOutOfboundException in Java

Class IndexOutOfboundException in Java IndexOutOfboundException object is thrown to indicate that an index (or some sort of ) is out of its allowed range or bounds. This applies to Array, Vector or a String. An application can subclass this class to indicate a similar kind of exception. Two subclasses of the  IndexOutOfboundException areas: StringIndexOutOfBoundsException ArrayIndexOutOfBoundsException The …

Class IndexOutOfboundException in Java Read More »