Every time when an error occurs, it is not possible to rectify them, which in turn slows down the application performance. To overcome this problem, exceptions are used. Exceptions are nothing but the expected errors that are tested and found solutions before the program gets executed. AWT Exceptions and Errors chapter gives a clear idea about
public AWTException (String message)
This consists a message that gives the information about the exception occurred.if (Problem) { throw new AWTException ("Problem occurred While Initializing"); }
IllegalComponentStateException is a run time exception and can be thrown only in 3 positions.
Using these is not illegal. Instead, these methods should be called after the completion of a particular task.
Constructor
public IllegalComponentStateException():
This constructor does not provide any message about the problem occurred.public IllegalComponentStateException(String message)
: This constructor gives the detailed information of the generated problem. This message can be obtained by using the getMessage() method.