A class implementing an interface must implement all of the methods defined in the interface,
while a class extending an abstract class need not implement any of the methods defined in the abstract class.
Additionally, a class extending an abstract class can implement an infinite number of it's own methods.
The basic purpose behind interfaces and abstract classes is that the class architect or programmers wants all the derived classes to implement the methods it has defined.. So whenever the abstract class is extended or an interface is implemented, all of its methods need to be overridden to avoid errors.
The most common question is"What is the difference between abstract classes and interfaces?"
The answer is : suppose you have many classes having some same methods, put the common functions/methods in abstract class or interface, but what to use in a particular case interface or abstract class.
Commonly interfaces are used, which expose a class's functionality to the out side world. But if you think that the classes share a common functionality, then put that common functionality in the abstract class.
So it means that you can define/implement a method in abstract class but you can not do so in interfaces.
all the variables defined in interfaces are public static and final implicitly so you do not need to write public static final by you self.
some links for more help:
http://forum.java.sun.com/thread.jspa?threadID=641243&messageID=3773498
If you have time read the following article, its great, else go to the end of the page and see the diff. b/w both..
http://jdj.sys-con.com/read/37695.htm
The basic purpose behind interfaces and abstract classes is that the class architect or programmers wants all the derived classes to implement the methods it has defined.. So whenever the abstract class is extended or an interface is implemented, all of its methods need to be overridden to avoid errors.
The most common question is"What is the difference between abstract classes and interfaces?"
The answer is : suppose you have many classes having some same methods, put the common functions/methods in abstract class or interface, but what to use in a particular case interface or abstract class.
Commonly interfaces are used, which expose a class's functionality to the out side world. But if you think that the classes share a common functionality, then put that common functionality in the abstract class.
So it means that you can define/implement a method in abstract class but you can not do so in interfaces.
all the variables defined in interfaces are public static and final implicitly so you do not need to write public static final by you self.
some links for more help:
http://forum.java.sun.com/thread.jspa?threadID=641243&messageID=3773498
If you have time read the following article, its great, else go to the end of the page and see the diff. b/w both..
http://jdj.sys-con.com/read/37695.htm
-I hope the question has been answered-
Cheers;
Ali Hammad