Results 1 to 2 of 2
  1. #1
    kian_hong2000 is offline Member
    Join Date
    Aug 2008
    Posts
    15
    Rep Power
    0

    Default 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?

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,585
    Rep Power
    23

    Default

    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.

Similar Threads

  1. difference between Abstract and interface
    By mrark in forum New To Java
    Replies: 3
    Last Post: 11-07-2009, 04:20 AM
  2. Can this be done using abstract class??
    By romina in forum New To Java
    Replies: 6
    Last Post: 03-02-2009, 12:46 PM
  3. Interface Vs Abstract Class
    By javarishi in forum New To Java
    Replies: 5
    Last Post: 06-15-2008, 05:43 AM
  4. Replies: 0
    Last Post: 04-02-2008, 07:04 AM
  5. Abstract Class
    By gapper in forum New To Java
    Replies: 4
    Last Post: 01-31-2008, 01:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •