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
please send me hr interview questions in it industry
Can a top level class be private or protected?
What is the size of string?
Can we override final method?
What are implicit objects in java?
Can we define constructor in inner class?
How dead lock situation occurs in java and how you can identify it?
What is independent and dependent variables in research?
What is an argument java?
What are serialization and deserialization?
What are the limitations of procedural programming approach?
does java support pointers?
What is predicate in java?
What is the difference between synchronized and synchronized block?
What are the steps that are followed when two computers connect through tcp?