what is difference between Interface and abstract class
Answer Posted / surender kannuri
interface is a specification of method prototype.
all methods in interface are abstract and final.
interface methods are public since they should be available
to third party vendor to provide implementation.they are
abstract because their implementation is left for third
party vendors.
interface contains 0 or more abstract methods.
all methods of interface should implemented in implemented
class.if any method is not implemented then implementation
class should be declared as abstract.
we can't create object to interface.but we can create
reference to interface type.
an interface contains variables ,such as public.static and
final variables.this means all variables of interface are
constant.
an interface cannot implements another interface.
an interface can extend another interface.
it is possible to write a class within an interface.
a class can implements(not extend) multiple interfaces.
abstract class contains 0 or more abstract methods.
all methods of abstract class should be implemented in
subclasses only.
all methods of abstract class should be declared by using
abstract keyword.
we can't create an object to abstract class.
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
What is the use of jtable?
What is difference between call by value and call by reference?
How to compare strings in java?
Why multiple inheritance is not supported by java?
How does thread synchronization occurs inside a monitor? What levels of synchronization can you apply?
what is the use of bean managed and container managed with example?
How to sort numbers in java without array?
How to add menushortcut to menu item?
What is the use of System class?
What is isa relationship?
How do you check if a string is lexicographically in java?
What is wrapper class html?
What is integer size in java?
What is the size of int in 64-bit jvm?
Is a method a function?