Page 2 of 2 FirstFirst 12
Results 21 to 31 of 31

Thread: Difference between interface and abstract class? are they both same

  1. #21
    Junior Member
    Join Date
    Mar 2009
    Answers
    1

    Re: Difference between interface and abstract class? are they both same

    Interface is the framework for methods . where only mehod signature and there is no implementation of a method.In Interface every method is abstract method.
    In abstract class there abstract method signature is available and which class extend this super
    class has to implement this abstract method.


  2. #22
    Junior Member
    Join Date
    Mar 2009
    Answers
    2

    Re: Difference between interface and abstract class? are they both same

    1)Abstract class is a collection of abstract methods and concrete methods or only abstract methods or only concrete methods
    Interface is a collection of only abstract methods
    2)the members of the abstract class are public(default),protected,static
    the members of interface are implicitly public
    3)A class can inherit one or more interfaces but a class can inherit only one abstarct class
    4)abstract class can add more functiuonality without destroying the child classes
    in an interface..creation of additional functions will have an effect on its child class due to necessary implementation of interface methods in child class


  3. #23
    Junior Member
    Join Date
    Mar 2009
    Answers
    2

    Re: Difference between interface and abstract class? are they both same

    I love Jave


  4. #24
    Junior Member
    Join Date
    Mar 2009
    Answers
    13

    Re: Difference between interface and abstract class? are they both same

    abstract class is a signature of class, can't be instantiated .
    it having some abstract members(both variables and methods) which are get implemented in to derived classes
    Interface is heaving all its methods (no any veriables) without implemented and all its methods are defaultly public because they all get implemented in derived classes but in abstract class only some its members may public

    Last edited by shilpamj; 04-02-2009 at 07:53 AM.

  5. #25

    Re: Difference between interface and abstract class? are they both same

    1) abstract class may or maynot be contain abstract methods,but interfaces must contain abstract methods only
    2)abstract class contains both abstract and concrete methods,concrete methods contain static,final and ordinary methods.
    3)abstract class contains all concrete or all static methods or all final methods or all abstract methods or combination of all the above.
    4)interface tells us what to do?,but not how to do
    5)both abstract class and interface particpates in object creation through the concept of dynamic binding.


  6. #26

    Re: Difference between interface and abstract class? are they both same

    both are same but we can implements one or more at a time but we can extend one class at a time


  7. #27
    Junior Member
    Join Date
    Sep 2009
    Answers
    4

    Re: Difference between interface and abstract class? are they both same

    Interface:

    >It contains only abstract methods .
    >it contains only constants but not instance variables.

    abstract:

    >it contains some abstract methods or concrete methods .
    >it contains only instance variables.



  8. #28
    Junior Member
    Join Date
    Sep 2009
    Answers
    4

    Re: Difference between interface and abstract class? are they both same

    hi

    Is java predefined or user-defined language ??
    Can u please help me out. thanq


  9. #29
    Junior Member
    Join Date
    Oct 2009
    Answers
    1

    Thumbs up Re: Difference between interface and abstract class? are they both same

    Hi,

    An interface is called as a pure abstract class where non abstract member functions are not allowed but in case of abstract classes we can have both abstract and non abstract member functions based on the requirement...


  10. #30
    Junior Member
    Join Date
    Dec 2008
    Answers
    7

    Re: Difference between interface and abstract class? are they both same

    a) All the methods declared inside an interface are abstract whereas abstract class must have at least one abstract method and others may be concrete or abstract.

    b) In abstract class, key word abstract must be used for the methodsWhereas interface we need not use that keyword for the methods.

    c)Abstract class must have subclasses whereas interface canít have subclasses.


  11. #31
    Junior Member
    Join Date
    Mar 2010
    Answers
    1

    Re: Difference between interface and abstract class? are they both same

    well,an abstract class can be thought of as consisting pure virtual methods:methods with zero body i.e just a signature of a method but moreover it may contain a definition of the method prototype too. abstract classes don't inhibit users to give method body in abstract class only but contrary to that interface does not allow a user to give method definition along with method prototype in an interface rather we need to create a class that will b implementing the method prototypes using overridden methods philosophy of OOP.


Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact