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
What is a "pure virtual" member function?
how to open and edit XML file in Weblogic???
What is struts in java?
What is super?
Are true and false keywords?
How can we use primitive data types as objects?
What is a vararg?
Can constructor be protected in java?
How many inner classes can a class have?
How do you use compareto method?
What design pattern you have used in your project? I answered Factory pattern, how it is implemented? What are its advantage? Do know about Abstract Factory?
What is the file type?
Is null or empty java?
Explain JMS in detail.
What do you understand by classes in java?