• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Why does this compile?

 
Author
Posts: 587
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 587
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ahh. I can now see the forest through the trees!

Thanks.
 
Ranch Hand
Posts: 531
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just relax. You'll pass. What are you sending to the client in terms of your application exception?
reply
    Bookmark Topic Watch Topic
  • New Topic