Thursday, June 18, 2009

Difference Between Abstract Class and Interface

Difference between abstract Class and Interface

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 methods
Whereas interface we need not use that keyword for the methods.

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

d) By default what ever variables we decalre in interface are public static final,where as in abstract class they can be default and instance variables also


Question

What does the keyword 'static' mean?

Answer

The static keyword denotes that a member variable, or method, can be accessed without requiring an instantiation of the class to which it belongs.

No comments:

Post a Comment