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 method overloading in java ?
How static variable work in java?
what is the difference between a threads start() and run() methods? : Java thread
What is variable argument in java?
How do you do descending order in java?
Define a package.
What is the meaning of flag day?
What are different types of states exist for a thread?
What are class types in java?
How do you identify if jvm is 32-bit or 64-bit from java program?
How do you achieve polymorphism in java?
Name few java util classes introduced with java 8 ?
What is parsing a string?
What are namespaces in java?
Is string pool garbage collected?