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
You can create a string object as string str = “abc”; why cant a button object be created as button bt = “abc”;? Explain
Explain the difference between string, stringbuffer and stringbuilder in java?
How many bytes are there?
What is ctrl m character?
What is treeset in java?
What is the function of http?
How do you sort an array in java?
Can a constructor call the constructor of parent class?
Is Java a dying language?
What is the purpose of stub and skeleton?
Why constructor has no return type?
What are the files generated after using IDL to java compiler?
what is encapsulation in java? Explain
What will happen if a thrown exception is not handled?
Why vector is used in java?