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
In java, what is the difference between method overloading and method overriding?
How many JVMs can run on a single machine and what is the meaning of Just-In-Time (JIT) compiler?
Q1.A. Write note on “The class path Environment Variable”? B. Which are different kinds of source code? Q2.A. How to create an interface? B. Why convert an applet to an application? Q3.A. How to use Media tracker Class. B. How to use string tokenizer class. Q4 A. Explain the overview of UDP messaging. B. Difference between SQL Exception class and SQL Warning class. Q5. A. How to create com object in Java? B. Write short notes on “The properties class” Q6. A. When object is created and destroyed? B. Explain the JDB in depth & command line. C. Write short notes on Web Sites.
what is the difference between Object Based Language and Object Oriented Language?
What is locale?
What about static nested classes in java?
Can an interface be final?
What is the main use of generics in java?
What are static initalizers in java ?
Explain about static nested classes in java?
What is ‘has a’’ relationship in java?
What about features of local inner class?
what do you mean by marker interface in java?
What is the difference between keyword and identifier?
What is java command?