-
Junior Member
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.
-
Junior Member
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
-
Junior Member
Re: Difference between interface and abstract class? are they both same
-
Junior Member
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.
-
Junior Member
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.
-
Junior Member
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
-
Junior Member
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.
-
Junior Member
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
-
Junior Member
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...
-
Junior Member
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.
-
Junior Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules