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

about RemoteException

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I am working in RMI.
In my server interface i have to throws RemoteException
and my server class i need to throws DatabaseException
so i got error message : overridden method doese not throw DatabaseException
I'm wondering should i add DatabaseException into server interface

Thanks,
lili
 
Andrea Gazzarini
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi lili,
Overridden methods can't throws a wider spectrum of exception than overriding methods, so if you have a superclass (or interface) with a method (for example)
void a() throws RemoteException;
you can't make a subclass with the signature above:
void a() throws RemoteException,DatabaseException;
if the situation look like this, you must include DatabaseException inton the signature of the superclass (interface)method
Hope it helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic