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
Which method cannot be overridden in java?
Why is stringbuffer called mutable?
What is the purpose of default constructor?
What is a Transient Object?
what is thread? What are the high-level thread states? : Java thread
Explain about oops concepts.
How do you start a new line in java?
What is return in java?
Can we use synchronized block for primitives?
what is the swingutilities.invokelater(runnable) method for? : Java thread
Tell some latest versions in JAVA related areas?
How do you use spaces in java?
How we can declare a static variable?
What is the difference between super class & sub class?
Explain the difference between abstract classes and interfaces in java?