What is the difference between abstract class and interface?

Answer Posted / ranganathkini

An interface is purely contractual in that it only defines
method headers but no implementation. Classes that implement
the interface must provide implementation to all method
defined by the interface.

An abstract class contains partial implementation, i.e. it
provides implementation for some methods where as just
defines abstract method headers for other. Abstract classes
cannot be instantiated directly and have to be extended by
subclasses who implement the abstract methods defined in the
abstract superclass. Unlike an interface, subclasses of the
abstract class only need to implement only those methods
that are marked abstract.

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a dynamic array java?

510


How can I right-justify a string?

619


What are the four pillars of java?

608


Explain the importance of import keyword in java?

519


Who found java?

547






What is garbage collector?

616


What is <> used for in java?

663


List primitive java types?

588


What are different types of multitasking?

538


What is the difference between array and array list in java?

600


What is the set interface in java programming?

623


Is java developer a good career?

548


If system.exit (0); is written at the end of the try block, will the finally block still execute?

613


Explain the difference between throw and throws in java?

540


Which is bigger double or float?

524