File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes about RemoteException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "about RemoteException" Watch "about RemoteException" New topic

about RemoteException

Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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

Andrea Gazzarini
Ranch Hand

Joined: Sep 09, 2002
Posts: 125
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.

Regards,<br />Andrea<br /> <br /><a href="" target="_blank" rel="nofollow">Andrea Gazzarini</a><br />Skype ID : gazzax72<br />Google Talk ID :<br /><a href="" target="_blank" rel="nofollow">My Blog</a>
I agree. Here's the link:
subject: about RemoteException
It's not a secret anymore!