This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JavaCaps mock 1 Q:9

 
Haining Mu
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Answer given:A,D
for D, in MyMethod() in MyExp2 class, Unchecked exception can be throw, even in method declare, it can throws Unchecked exception.
I think if D says: MyMethod() cannot declare IOException exception in MyExp2 class , then it would be correct.
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with you here. Java insists that an overriding method can not throw a checked exception not thrown by the method it is overriding. It can however throw runtime exceptions.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic