what are Checked & Unchecked exceptions ?

Answers were Sorted based on User's Feedback



what are Checked & Unchecked exceptions ?..

Answer / aparna

Checked exceptions should be taken care by the user using
try and catch blocks otherwise runtime error occurs
for eg:
class.forName() method throws ClassNotFoundException which
should be caught between try and catch blocks

Unchecked exceptions are taken care by the jvm itself, user
need not worry about these type of exceptions
for eg:
Integer.parseInt() method throws NullPointerException which
need not be placed between try and catch blocks

Is This Answer Correct ?    5 Yes 0 No

what are Checked & Unchecked exceptions ?..

Answer / harmeet

Checked Exceptions must be caught and thrown by the user
otherwise compile time error will be displayed saying it
must be catched. We've to catch those exceptions using try
and catch blocks.
Eg:Class.forName() throws ClassNotFoundException, when
trying to load the specified file in class.forName().

whereas Unchecked Exceptions are handled by jvm, user need
not to handle those exceptions.

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More Core Java Interview Questions

What is map in java?

0 Answers  


Which class is the immediate superclass of the Container class?

1 Answers  


What technique is carried out to find out if a particular string is empty?

0 Answers  


Explain difference between final, finally and finalize?

3 Answers   Cognizant,


What is difference between static class and singleton pattern?

0 Answers  






What is a void in java?

0 Answers  


my method "abc" return array of interface "xyz" and "pqr" is abstract class implements abc and class "jkl" extends pqr My problem 1) when i call abc it retrun array xyz how can i do this hint xyz refer_xyz = new jkl(); but i can't create array. 2)I want to access method of jkl using reference of xyz??

1 Answers  


i need to know the website that i can compile and run a java code in online.(while system doesn't contain any jdk and jre)

0 Answers  


What is a literal coding?

0 Answers  


What are the different data types in java?

0 Answers  


Can we have a method name same as class name in java?

0 Answers  


What is a bubble sort in java?

0 Answers  


Categories