Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception handling during inheritance

 
Anu satya
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I had been to one interview, there they gave me a code:


is it a valid code? how to manage exceptions when a class is inherited?

According to my knowledge, IO Exception is handled in class A so, there is no need to handle it again the child class...hope i am correct.
Please correct me if i am going wrong some where.

Regards,
Anu
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you cant use throws with class name . in java method only should use throws . use try and catch to handle an Exception.

For Your Information Exception Handling

Hope this helps
 
Campbell Ritchie
Sheriff
Pie
Posts: 48972
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are at least two more compiling errors in that code. Is that exactly what they provided?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic