ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories  >>  Software  >>  Core Java  >>  Java J2EE  >>  Java Related
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
What is the difference between Checked and Unchecked
exception? Give some examples
 Question Submitted By :: Maria
I also faced this Question!!     Rank Answer Posted By  
 
  Re: What is the difference between Checked and Unchecked exception? Give some examples
Answer
# 1
1.	Checked exceptions are exceptions that must be 
declared in the throws clause of a method. A checked 
exception indicates an expected problem that can occur 
during normal system operation. Checked exceptions must be 
2.	Unchecked exceptions are exceptions that do not 
need to be declared in a throws clause. An unchecked 
exception indicates an unexpected problem that is probably 
due to a bug in the code. The most common example is a 
NullPointerException.They don't have to be caught or 
declared thrown.
3.	Checked exceptions in Java extend the 
java.lang.Exception class. Unchecked exceptions extend the 
java.lang.RuntimeException. 
 
Is This Answer Correct ?    0 Yes 1 No
Padmaja
 
  Re: What is the difference between Checked and Unchecked exception? Give some examples
Answer
# 2
checked Exceptions must be dealt with in either a try/catch
block or by
declaring a "throws" in a method. Unchecked exceptions
normally are
Runtime exceptions like NullPointerException or
ClassCastException.

A simple rule of thumb: If it's an exception you can
possibly deal with
(continue to run the program using some alternative code),
use checked
exceptions. For exceptions that should never happen (if they
do, it's a
bug), use unchecked (Runtime) exceptions which will come up
to the
surface and displayed to the user. Like this you assure that
if there's
a bug, it will show up eventually and can be fixed, and you
don't run
the risk of catching an exception and forgetting to deal
with it (f.i.
empty catch block).
 
Is This Answer Correct ?    2 Yes 0 No
Narendra
 
 
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
Explain method overloading and overriding?  6
Explain about global variables in Java?  2
What is operator?  2
what is difference between method overloading & method overridding with example? IBM2
Can we place the any object to key attribute of HashMap<key,value>? HCL3
Explain difference between final, finally and finalize?  2
how to use finalize()Method to resources TCS2
How is Garbage collection done in Java? T3-Softwares2
how you will prevent method overriding? HCL4
why to use transient variables when static variables can be used for Serialization  3
Which method is used to find that the object is exited or not?  1
diff between abstract methods and interfaces with programing (code) example?  2
What is Collections API?  1
What are Access Specifiers and Access Modifiers. TCS3
What is UNICODE?  3
How do u provide security in java  1
is memory to the abstract class allocated ..or objects not instantiated TCS4
What is update method and when it is called?  1
What are the traverses in Binary Tree? Adobe2
Why Wait and notify are kept in Object class although they are used only with Thread Class Saksoft2
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com