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
Give me example of derived data types.
what is the volatile modifier for? : Java thread
What comes to mind when someone mentions a shallow copy in java?
How to change the priority of thread or how to set the priority of thread?
What are keywords give examples?
What is the difference between numeric and integer?
Explain a few methods of overloading best practices in java?
If a class is declared without any access modifiers, where can the class be accessed?
What are multiple inheritances?
What is the difference between double and float variables in java?
Is array primitive data type in java?
What is the static method?
What is the buffer limit?
How does thread synchronization occurs inside a monitor? What levels of synchronization can you apply?
Can a method be overloaded based on different return type but same argument type?