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
How do generics work in java?
You're given a Boolean 2D matrix, can you find the number of islands?
What is meant by object oriented programming – oop?
How is Object Oriented Programming different from Procedure Oriented Programming?
Why scanner is used in java?
What is the purpose of static methods and static variables?
Why to use nested classes in java?
What is a finally block?
Can you extend main method in java?
What is qualitative variable?
What is skeleton and stub? What is the purpose of those?
What do you mean by object?
Explain the features of java?
What methodology can be utilized to link to a database?
What is a substring of a string?