All exceptions are system defined classes. They are subclasses of either ‘Exception’ or ‘RuntimeException’ class. We can also instantiate them. Some common system-defined exceptions are listed below.
Exception Type | Cause of Exception |
ArithmeticException | Caused by math errors such as division by zero |
ArraylndexOutOfBoundsException | Caused by bad array indexes |
ArrayStoreException | Caused when a program tries to store the wrong type of data in an array |
FileNotFoundException | Caused by an attempt to access a nonexistent file |
lOException | Caused by general I/O failures, such as inability to read from a file |
NullPointerException | Caused by referencing a null object |
NumberFormatException | Caused when a conversion between strings and number fails |
OutOfMemory Exception | Caused when there's not enough memory to allocate a new object |
SecurityException | Caused when an applet tries to perform an action not allowed by the browser's security setting |
StackOverFlowExceptlon | Caused when the system runs out of stack space |
StringlndexOutOfBoundsExceptlon | Caused when a program attempts to access a nonexistent character position in a string |
0 comments:
Post a Comment