a) Can an Interface implement another interface? b) How can an Interface extend more than one Interface? c) If Interface can Implement as well as extend other Interfaces, then what is the difference between Extending and Implementing Interfaces? d) When you extend an Interfaces, do you also extend all the Constants declared in Super Interfaces?
Hope Someone would help
Sandy
Regards<br />Sandy<br />[SCJP 5.0 - 75%]<br />[SCWCD 1.4 - 85%]<br />------------------<br />Tiger, Tiger burning bright,<br />Like a geek who works all night,<br />What new-fangled bit or byte,<br />Could ease the hacker's weary plight?
Sir, I had tried the code....and i did not compile
test25.java:2: '{' expected interface B implements A { } ^ test25.java:7: '}' expected } ^ 2 errors
since the error are not descriptive, so i concluded that either this is not the way to implement interfaces, or you cannot implement an interface
the post was just to confirm that if i am right.
anyways my 2nd questions is still unanswered b) How can an Interface extend more than one Interface?(while in jave we can extend only one class ) [ September 12, 2005: Message edited by: Sandeep Chhabra ]
Regards<br />Sandy<br />[SCJP 5.0 - 75%]<br />[SCWCD 1.4 - 85%]<br />------------------<br />Tiger, Tiger burning bright,<br />Like a geek who works all night,<br />What new-fangled bit or byte,<br />Could ease the hacker's weary plight?
Think about it this way. An interface does not implement any of the methods that it specifies, it is left to a class to implement interface and provide an implementation for the methods. So an interface will not implement anything from its superinterfaces. It can only extend the superinterface perhaps by adding more method specifications for its implementing classes to implement.
By definition a class can implement zero or more interfaces but can only extend one superclass. This is a choice made by the designers of the Java Specification, they did not choose to follow the model of C++ where you can extend multible superclasses.
You have been a great help to me...i have learned a lot from you till date.. and i wish to keep learning from all u people in the same way.. and thanx for your suggetions i would surely consider it.
Regards<br />Sandy<br />[SCJP 5.0 - 75%]<br />[SCWCD 1.4 - 85%]<br />------------------<br />Tiger, Tiger burning bright,<br />Like a geek who works all night,<br />What new-fangled bit or byte,<br />Could ease the hacker's weary plight?
look! it's a bird! it's a plane! It's .... a teeny tiny ad
a bit of art, as a gift, that will fit in a stocking