how to make a un-checked exception as a checked exception one.

Answers were Sorted based on User's Feedback



how to make a un-checked exception as a checked exception one...

Answer / janardhan

If a client can reasonably be expected to recover from an
exception, make it a checked exception. If a client cannot
do anything to recover from the exception, make it an
unchecked exception.

Is This Answer Correct ?    1 Yes 1 No

how to make a un-checked exception as a checked exception one...

Answer / suvarna

Wrapping Checked Exceptions in Unchecked Exceptions
try {
// ... some code that could throw IOException or
RemoteException
} catch(Exception ex) {
throw new RuntimeException(ex.toString());
}

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More Core Java Interview Questions

Can sleep() method causes another thread to sleep?

0 Answers  


Is space a character in java?

0 Answers  


From the two, which would be easier to write: synchronization code for ten threads or two threads?

0 Answers  


What are the different types of sorting in java?

0 Answers  


What are batch updates. in jdbc

2 Answers   Corent Technology,


What is stringwriter?

0 Answers  


What happens if an exception is throws from an object's constructor?

0 Answers   Amazon,


can we override the main() method in java????

3 Answers   Vimukti Technologies,


How you can force the garbage collection?

0 Answers  


what do you understand by synchronization? Or what is synchronization and why is it important? Or describe synchronization in respect to multithreading? Or what is synchronization? : Java thread

0 Answers  


What is difference between public static and void?

0 Answers  


If I will write String s=new String("XYZ"); String s1=new String("XYZ"); if(s.equals(s1)){ sop("True"); } else{ sop("False"); } This program will give me "True". But When I am creating my own class suppose class Employee{ public Employee(String name); } Employee e= new Employee("XYZ"); Employee e1 = neew Employee("XYZ"); if(e.equals(e1)){ sop("True"); } else{ sop("False"); } Then it will give the output as "False". Can I know what is happening internally?

5 Answers  


Categories