aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes deadly diamond of death syndrome :) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "deadly diamond of death syndrome :)" Watch "deadly diamond of death syndrome :)" New topic
Author

deadly diamond of death syndrome :)

Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

Please, have a look:


The second one:


Compiler allows you to declare the common exception from within multiple interfaces. If the interfaces' exceptions are uncommon you will not be allowed to declare any checked exception.

I only wanted to figure this out.
Correct me if I am wrong.


SCJP6, SCWCD5, OCE:EJBD6.
BLOG: http://leakfromjavaheap.blogspot.com
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6657
    
    5

That makes sense

For common exception hierarchies




If InterfaceC is allowed to throw IOException then a statement like InterfaceB ref = new SubClassThatThrowsIOExAndImplementsC(); will get into trouble since the Exception scope does not allow this. IOException is wider than FileNotFoundException and the InterfaceB contract only allows you to throw FileNotFoundException

So InterfaceC can only throw FileNotFoundException

For the scenario



InterfaceC is in trouble. For case



So InterfaceC cannot throw anything, since the contract provided by InterfaceA or InterfaceB can be broken

Does that make sense ?


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: deadly diamond of death syndrome :)
 
Similar Threads
Cyclic class
Please tell me the program flow..
Can't understand the Output
Why public?
Class Object and Hierarchy