Friday 24 December 2021

Predefined Exceptions Java

An exception is an event that may cause abnormal termination of the program during its execution. There are two types of exceptions in java.

1. Checked exceptions

These exceptions are explicitly handled in the code itself with the help of try-ctach block. Checked exceptions are extended java.lang.Exception class

2. Unchecked Exceptions

These are not essentially handled in the program code; instead the JVM handles such exceptions; Unchecked exceptions are extended from java.lang.Runtime exception class

The following is the java exception Hierarchy 

The following are the predefined exceptions in Java

  1. ArithmeticException -Caused by Math errors such as division by zero
  2. ArrayIndexOutOfBoundException - Caused by bad arrays indexes 
  3. ArrayStoreException - Caused when a program tries to store wrong type of data in an array.
  4. FileNotFoundException - Caused by an attempt to access non existing file
  5. IOException - Caused by general I/O failures, such as inability to read from a file
  6. NullPointerException - Caused by referencing a null object.
  7. NumberFormatException - Caused when a conversion between string and number fails.
  8. OutOfMemoryException - Caused when there is not enough memory to allocate a new object.
  9. SecurityException - Caused when an applet tries to form an action not allowed by the browser security settings.
  10. StackOverFlowException - Caused when the system runs out of stack space
  11. IllegalThreadStateException - A thread has be moved illegally from one state to other state.
  12. ClassNotFoundException - A class cannot be found
  13. IllegalArgumentException - Illegal arguments used to invoke a method


0 comments :

Post a Comment

Note: only a member of this blog may post a comment.

Machine Learning

More

Advertisement

Java Tutorial

More

UGC NET CS TUTORIAL

MFCS
COA
PL-CG
DBMS
OPERATING SYSTEM
SOFTWARE ENG
DSA
TOC-CD
ARTIFICIAL INT

C Programming

More

Python Tutorial

More

Data Structures

More

computer Organization

More
Top