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

Why does this compile?

 
Robert James Liguori
Author
Ranch Hand
Posts: 553
5
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
Pie
Posts: 12014
220
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: 553
5
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: 527
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?
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic