what are Checked & Unchecked exceptions ?
Answers were Sorted based on User's Feedback
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 |
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 |
What are the characteristics provided in jdk1.6 apart from other versions?
Can final class have constructor?
system.out.println(1 + 3);
What environment variables do I need to set on my machine in order to be able to run java programs?
How to change the priority of thread or how to set the priority of thread?
What is the purpose of object oriented programming?
What is vector capacity in java?
What is :: operator in java?
What is the purpose of java?
What is meant by class loader? How many types are there?
"We cannot create an object of interface but we can create a variable of it". Discuss the statement with the help of an example. (Plz help us to provide immediately.)
Is a method a procedure?