GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  J2EE  >  Core Java
Go To First  |  Previous Question  |  Next Question 
 Core Java  |  Question 43 of 492    Print  
What are the different kinds of exceptions? How do you catch a Runtime exception

  
Total Answers and Comments: 8 Last Update: February 14, 2008   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
June 26, 2005 07:17:11   #1  
Ashutosh Gupta        

RE: What are the different kinds of exceptions? How do you catch a Runtime exception
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.

 
Is this answer useful? Yes | No
July 01, 2005 04:49:42   #2  
Arundathi        

RE: What are the different kinds of exceptions? How do you catch a Runtime exception
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 

 
Is this answer useful? Yes | No
September 11, 2005 11:35:02   #3  
ROHIT        

GOOD QUEST

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.


 
Is this answer useful? Yes | No
January 05, 2007 04:58:59   #4  
Prabin balakrishnan        

RE: What are the different kinds of exceptions? How d...

There are manily 2 types of exceptions

1:checked


 
Is this answer useful? Yes | No
January 05, 2007 05:08:54   #5  
Prabin balakrishnan        

RE: What are the different kinds of exceptions? How d...

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.


 
Is this answer useful? Yes | No
August 02, 2007 07:14:43   #6  
javalearner        

RE: What are the different kinds of exceptions? How d...
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

 
Is this answer useful? Yes | No
October 30, 2007 06:09:21   #7  
Shagufta Mogal        

RE: What are the different kinds of exceptions? How d...
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.

 
Is this answer useful? Yes | No
February 14, 2008 01:53:31   #8  
sampra Member Since: February 2008   Contribution: 279    

RE: What are the different kinds of exceptions? How do you catch a Runtime exception
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. 

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape