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
How to obtain a performance profile of java program
Can I learn java in 3 months?
What is an example of a conditional statement?
What is the purpose of the finalize() method?
How can you generate random numbers in java?
What is bifunction in java?
Difference between notify() method and notifyall() method in java?
How to perform quicksort in java?
What is string args [] in java?
What is the default size of set in java?
Explain the difference between association, aggregation and inheritance relationships.
Explain the difference between abstract classes and interfaces in java?
What is dynamic binding(late binding)?
What does jre stand for?
What is meant by flickering?