when to use abstract class and when to use interface?
Answer Posted / amit
Abstract provides both methods with and without body.
Adding new methods in abstract class in middle of
development life cycle won't break existing sub classes
unless these methods are declared as mustoverride. If there
are frequent addition of new methods properties and so on.
one should use abstract..
Whereas on the other hand interface can fill gap of
multiple inheritance. One can
implement from more than one interface. Not same with
Abstract. One can inherit
from only one abstract class.
| Is This Answer Correct ? | 44 Yes | 6 No |
Post New Answer View All Answers
What is an immutable object?
What is byte data type?
What is scope & storage allocation of global and extern variables? Explain with an example
What is type inference in java8?
if u open login & logout ,how can udisplay the timelogin & logout members ?
Can memory leak happen java?
Discuss about garbage collector in Java.
What does t in java mean?
what is the purpose of the runtime class?
Is multiple inheritance supported by java?
What is the difference between static method and instance method in Java?
What is the difference between abstraction and encapsulation?
Does java map allow duplicates?
What are decalarations?
What happens when you invoke a thread’s interrupt method while it is sleeping or waiting?