• Post Reply Bookmark Topic Watch Topic
  • New Topic

Why does this compile?

 
Robert James Liguori
Author
Ranch Hand
Posts: 578
6
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the code for the SCJD study guide...

I'm a bit confused...

How does the methods in DvdDatabaseImpl (which throw RemoteExceptions) implement the interface methods for DvdDatabaseRemote (which do *not* throw RemoteExceptions).

I would think that this would not compile, (i.e. I expect this text "...in sampleproject.db.DBClient; overriden method does not throw java.rmi.RemoteException"). However, the code compiles fine.

Any explanation why this compiles would be appreciated.
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Posts: 12056
232
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is actually one of the areas where we made the book's assignment simpler than Sun's assignments. (But I believe we explain it in the book).

Basically all the methods in DBClient throw IOException, and RemoteException is a child of IOException.

Does that help?

Regards, Andrew
 
Robert James Liguori
Author
Ranch Hand
Posts: 578
6
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ahh. I can now see the forest through the trees!

Thanks.
 
Anton Golovin
Ranch Hand
Posts: 531
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just relax. You'll pass. What are you sending to the client in terms of your application exception?
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!