what is the difference between abstract class and
Interface?where we can use it in realtime projects?
Answer Posted / abilash
1)If we r having 2 classes, both classes need a method with
same business logic(definition). Then we can go for an
abstract class. In this abstract class we can define the
method with functionality. And the two classes will extend
this abstract class.
2)In other case if two different classes wants two different
functionalities with same method name , then we go for an
interface with abstract declaration of method.And the two
classes will implement the interface and override the method
with different business logic
Is This Answer Correct ? | 31 Yes | 12 No |
Post New Answer View All Answers
What is static variable with example?
Explain the difference between an object-oriented programming language and object-based programming language?
Can memory leak happen java?
What are java annotations?
What are the benefits of operations in java?
What classes of exceptions may be caught by a catch clause in java programming?
Explain the use of volatile field modifier?
What is the difference between call by reference and call by pointer?
What is an immutable object?
How can we access some class in another class in java?
What is not object oriented programming?
Is call by reference possible in java?
Is hashset sorted in java?
What is java lang object?
What is java reflection?