Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compiler do not complain in the interface-implementating class

 
Gerry Lau
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sorry that I could not find the answer of this question from the reference book and web resources.
I found that compiler do not complain that even if the method in the interface throws a particular exception (e.g. IOException), the interface-implementing class need not throws the same exception in its method. On the other hand, the class method could throws even more exceptions (e.g. IOException, RemoteException) than the interface method specify.
Is the exception clause in the interface method actually ignored in java?
In the view of OO design, is it regarded as bad design to deliberately discard one of the exception specified in interface in the implementing class?
The last question, if the remote client have the same public methods as suncertify.db.Data class but throws more exception(e.g. RemoteException), is that still regarded as "The remote client code that I write provide all the public methods of the suncertify.db.Data class."?
Thx for any of your advice!
Gerry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic