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       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
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
 
what is generics in jdk1.5? Bally-Technologies1
what is the difference between pagecontext and servletcontext? JBA-Infotech4
What is a reflection package?  2
While opening the file, what type of exceptions can be caught?  3
Name the package that always imported by default?  2
Hi Friends, can you give difference between extending thread class and implementing runnable interface.  2
When you Click a Button, What event will be fired?  2
Difference between String and String Buffer?  3
What is an abstract class and abstract method?  4
What are access modifiers in Java ?  5
Can we have a abstract class withought any method? What is a purspose of this?  1
What is the differnence between String Buffer and String builder despite having knowledge that String builder is faster than String Buffer and last one is threadsafe.please tell another important difference.  3
why Runnable interface is preferable than extending the Thread class? Wipro5
Difference between JDK, JRE, JVM Oracle5
what is the difference between abstract class and Interface?where we can use it in realtime projects? Logica-CMG10
what is polymorphism? Zensar5
What is more advisable to create a thread, by implementing a Runnable interface or by extending Thread class?  5
what is meant by serialization?  6
Which method is used to find that the object is exited or not?  1
Same common question what is Map,Set,HashMap,List???? Symphony3
 
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