aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes SCJD book: Implementing two Interfaces 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 "SCJD book: Implementing two Interfaces" Watch "SCJD book: Implementing two Interfaces" New topic
Author

SCJD book: Implementing two Interfaces

Michael Enudi
Greenhorn

Joined: Apr 24, 2011
Posts: 20
Good day all,

I am particularly new to this site and want to ask a question that really bothers me.

In the book "SCJD Exam with J2SE" by Andrew Monkhouse and Terry Camerlengo, I find something very worrying.


In the book, the author created a class DBClient and another DvdDatabaseRemote which is basically a remote extension of the DBClient interface. The code has it thus


What surprises me is that the implementation of the class which is


has some of its method throwing RemoteException whereas the declaring methods don't. How possible is that, knowing that in java you cannot throw a newer Exception while overriding a method?

Secondly, how is it possible for remote object to publish its remote method without throwing the RemoteException?

I find these two issues with the book but I don't know If I am the one seeing things rather blurred.
I would appreciate clarification.


Regards.
Marcel van den Boer
Greenhorn

Joined: Apr 19, 2011
Posts: 21

RemoteException is-a IOException, and IOException is declared in DBClient.

An other example:


OCPJP
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5389
    
  13

When I have a look at the methods in DBClient, I see that all methods have a throws IOException clause, e.g.

And if you would have made the effort to take a look at the javadoc of RemoteException, you would have noticed that IOException is its parent class, so completely valid overrides.

[edit] Marcel was a lot quicker (even after refreshing the page, I didn't see his reply)


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Michael Enudi
Greenhorn

Joined: Apr 24, 2011
Posts: 20
Thanks guys, I did not know what I was looking at. Assumption led me astray.

Thanks for the pointer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SCJD book: Implementing two Interfaces