Hey Fellow ranchers, I have a few questions in regards to Abstract vs. Interface. What exactly are the difference between the two. Except the fact that Interfaces can be used a Object types I really don't see the difference. So here 's my questions. 1.) Abstract - Class which implement Abstracts must provide impletmentation of all prototype methods in Abstract. Or the implementing classes become abstract themselves. Ans. I think this is true 2.) The same as above applies for interfaces? Ans. I think this is true also.
3.) Can an Interface have an static member? Thanks in advance for all the help, Malik
Regards,<BR>Travis M. Gibson, SCJP<BR>Java Developer<BR>www.travismgibson.com<BR>firstname.lastname@example.org
Hi Travis, 1. Yes, if a class extends an Abstract class it must be provide implementation for all the methods. If it does not it must declared as an Abstract class itself. 2. Yes. Any class implementing an Interface must override all the interface methods. 3. Yes. Interface variables are automatically public and static. The main difference is that Interfaces guarantee a given behaviour BUT not how the behaviour occurs. Abstract classes can contain a mix of fully implemented methods and empty methods ie there's usually only one or two the subclass needs to provide implentation on. Hope that helps. ------------------ Jane