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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the null?

775


What is finalize()? Is finalize() similar to a destructor?

742


Can final class have constructor?

698


What all access modifiers are allowed for top class ?

946


Why declare Main() inside the class in java ?

801


What is canonical name in java?

832


What is static synchronization?

767


What is jee6?

746


What is ‘has a’’ relationship in java?

947


What is meant by class?

767


What things should be kept in mind while creating your own exceptions in java?

855


What is the final method?

830


What is a byte array?

850


What is byte code and why is it important to java’s use for internet programming?

815


What is an anonymous class in java?

777