Originally posted by Higor Zardo:
look this:
I don't understand why compiler return: "unreported exception MyException; must be caught or declared to be thrown".
But doStuff() don't caught the exception??
Thanks!!
I saw two problem in your code:
1: class MyException
extend Exception {
you know how to fix it? right..
2:
when you call doStuff method, you have declared that you might throw a checked exception..and you did..!!
try --> Exception thrown (E1)
for E1, you need to implement..."HANDLE OR THROW RULE"..!! you decided to handle it..!!
catch ---> Exception thrown (E2)
for E2,, you need to implement..."HANDLE OR THROW RULE"..!!
do something for it also..this is what compiler is asking for..!!
I hope ..i cleared you what is your problem..!! Now fix it..