Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What is the difference between Checked and Unchecked
exception? Give some examples

Answers were Sorted based on User's Feedback



What is the difference between Checked and Unchecked exception? Give some examples..

Answer / narendra

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 ?    4 Yes 1 No

What is the difference between Checked and Unchecked exception? Give some examples..

Answer / padmaja

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 ?    2 Yes 4 No

Post New Answer

More Core Java Interview Questions

How can we make a class virtual?

0 Answers   Fidelity,


What is a return in java?

0 Answers  


how we can write the string concatenation program in java.

3 Answers  


Can you have an inner class inside a method and what variables can you access?

2 Answers  


What are the types of statement? explain

1 Answers   SysBiz,


Can we use different return types for methods when overridden?

0 Answers  


what is multithreading?

5 Answers   Virtusa,


Find the value of a specified element of the array arr[i] where 0 <= i <= n-1

0 Answers   Amazon,


Outline the major features of java.

0 Answers  


What is a treemap in java?

0 Answers  


What is difference between throw and throws ?

0 Answers   Cyient,


what is wrapper class and its uses?

2 Answers  


Categories