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

Difference between a process and a program?

835


Can interface be private in java?

774


Why is String immutable?

849


What is a jagged array in java?

796


How do you get the length of a string in java?

755


What occurs when an object is constructed?

783


How would you dynamically allocate memory to an array?

809


What is a control variable example?

778


What is extension method in java?

814


Objects or references which of them gets garbage collected?

742


What is public/private protected in java?

801


How many types of exception can occur in a java program?

730


Can you explain the cs option of java interpreter?

721


Explain importance of inheritance in java?

802


What is run time allocation?

794