This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
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

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "SCJD book: Implementing two Interfaces" Watch "SCJD book: Implementing two Interfaces" New topic

SCJD book: Implementing two Interfaces

Michael Enudi

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.

Marcel van den Boer

Joined: Apr 19, 2011
Posts: 21

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

An other example:

Roel De Nijs

Joined: Jul 19, 2004
Posts: 7946

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
Michael Enudi

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:
subject: SCJD book: Implementing two Interfaces
It's not a secret anymore!