• Post Reply Bookmark Topic Watch Topic
  • New Topic

Why does this compile?  RSS feed

 
Robert James Liguori
Author
Ranch Hand
Posts: 584
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: 12101
246
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: 584
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?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!