Results 1 to 2 of 2
Thread: Interface and Abstract Class
- 08-27-2008, 11:58 AM #1Member
- Join Date
- Aug 2008
- Rep Power
Interface and Abstract Class
I am getting confuse with inteface and abstract.
Usually in what situation we will use these two classes instead of normal classes that the API provide. What are their differences?
I heard from my friend that interface is more for GUI based application and abstract is to create own methods.
If it is right, why we need to create our own methods since API has so many classes to use?
- 08-27-2008, 02:22 PM #2
Sounds like you need to do some more reading on the differences between an interface and an abstract class.
Neither one is specifically used for any type of application. Both can be use for ALL kinds of applications.
Using an interface allows you to set a class's type. By implementing an interface your class IS A type as defined by the interface. A class can be many different types this way. Your code must define ALLthe methods defined in the interface.
An abstract class is a partially implemented class. When you extend it you MUST define the methods in the class that are abstract. Your code can only extend ONE abstract class.
- By mrark in forum New To JavaReplies: 3Last Post: 11-07-2009, 04:20 AM
- By romina in forum New To JavaReplies: 6Last Post: 03-02-2009, 12:46 PM
- By javarishi in forum New To JavaReplies: 5Last Post: 06-15-2008, 05:43 AM
- By Santoshbk in forum Advanced JavaReplies: 0Last Post: 04-02-2008, 07:04 AM
- By gapper in forum New To JavaReplies: 4Last Post: 01-31-2008, 01:25 PM