What are the different kinds of exceptions? How do you catch a Runtime exception

Showing Answers 1 - 18 of 18 Answers

Ashutosh Gupta

  • Jun 26th, 2005
 

There are 2 types of exceptions. 
1. Checked exception 
2. Unchecked exception. 
 
Checked exception is catched at the compile time while unchecked exception is checked at run time.

  Was this answer useful?  Yes

Arundathi

  • Jul 1st, 2005
 

1.Checked Exceptions  
Environmental error that cannot necessarily be detected by testing; e.g. disk full, broken socket, database unavailable, etc.  
2.Errors  
Virtual machine error: class not found, out of memory, no such method, illegal access to private field, etc.  
3.Runtime Exceptions  
Programming errors that should be detected in testing: index out of bounds, null pointer, illegal argument, etc.  
 
Checked exceptions must be handled at compile time. Runtime exceptions do not need to be. Errors often cannot be 

  Was this answer useful?  Yes

ROHIT

  • Sep 11th, 2005
 

CHECKED EXCEPTION:  WHICH R KNOWN AT THE COMPILE TIME.EG PASSING OF WRONG NO OF ARGUMENTS.

UNCHECKED EXCEPTION:WHICH RC KNOWN AT THE RUN TIME EXCEPTION.EG NUMBER DIVIDE BY 0.

  Was this answer useful?  Yes

Prabin balakrishnan

  • Jan 5th, 2007
 

There are manily 2 types of exceptions

1:checked

  Was this answer useful?  Yes

Prabin balakrishnan

  • Jan 5th, 2007
 

There are maily 2 types of exceptions checked and unchecked

Checked exceptions are subject to the Catch or Specify Requirement. All exceptions are checked exceptions, except for those indicated by Error, RuntimeException, and their subclasses. 

Unchecked Exceptions are Errors , RuntimeErrors and its subclasses

Eg: Checked exception :When the application trying to read the contents of a file  which does not  exists then it throw a FileNotFoundException.

   Error : Suppose that the File is Exist.But the FileReader coulnot read the file due to any system mulfunction or hard ware problems ,tehn it throw an IOError.

  Error : Suppose that the File is Exist.But the FileReader coulnot read the file due to any system mulfunction or hard ware problems ,tehn it throw an IOError.

  Was this answer useful?  Yes

javalearner

  • Aug 2nd, 2007
 

Throwable is super class for all other exception classes.
of which it is divided in to two types
1)errors: unrecoverable exceptions are called errors
2)Exceptions:  recoverable exceptions are called Exceptions
Exceptions are classified in to 2 types
1)Checked Exceptions:exceptions caught at compile time are called are called checked Ecepotions.Examples
1)class not found exceptions
2)file not found exception
3)sql exceptions
4)IO Exceptions
2)unChecked Exceptions:exceptions caught at runtime time are called are called unchecked.Examples
1)arithematic exceptions
2)null pointer exceptions
3)array index out of bound Exception

Shagufta Mogal

  • Oct 30th, 2007
 

Two kinds of exceptions:unchecked exceptions and checked exceptions.

Inside the standard java.lang package ,Java defines several exception classes.
Most of the exceptions are subclasses of standard type RuntimeException.
java.lang
is automatically imported to programs in Java.
So most exceptions derived from RuntimeException are automatically available .
They need not be included in any method's throws list.
Compiler
does not check to see if a method handles or throws these exceptions.
Such exceptions are called unchecked exceptions.


Exceptions defined by java.lang that must be included in a method's throws list are called checked exceptions.

  Was this answer useful?  Yes

sampra

  • Feb 14th, 2008
 

1.Checked Exceptions  
Environmental error that cannot necessarily be detected by testing; e.g. disk full, broken socket, database unavailable, etc.  

2.Runtime Exceptions  
Programming errors that should be detected in testing: index out of bounds, null pointer, illegal argument, etc. 

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions