Hi I could have tried it instead of asking on forum but due to some sw problem I could not do Can any one pls tell me whether it is legitimate or not? abstract class says it implemnets an interface but instaed of impleneting the methods it declares them as abstract Is it legal?
SCJP,SCWCD,SCBCD<br />If Opportunity doesn't knock then build the door
Joined: Jan 30, 2000
Yes. Any concrete subclass will have to implement the abstract methods, so they will be implemented by the time any JVM is asked to invoke the method. It's just a special case of implementing by forcing subclasses to implement for you.
"I'm not back." - Bill Harding, Twister
Joined: Nov 22, 2008
Originally posted by Gaurav Chikara: abstract class says it implemnets an interface but instaed of impleneting the methods it declares them as abstract Is it legal?
As Jim already explained; yes this is perfectly legal. Even more, your abstract class doesn't even have to mention the methods in the interface it 'implements' (mind the quotes), e.g. the following:
is perfectly legal. If a subclass of YourClass wants to be concrete class, it has to implement both foo() and bar(). kind regards