can u give one sinario when you use Abstract Class and When
you use Interface.
Answer Posted / srinivasa
If we have more than two classes with same method names but
their implementation is different.we can go for interface.
Example: JDBC API Interfaces. Every data base vender
implements these interfaces with thier implementation code.
If we want to use some common method implementaions for
multiple classes along with their own implementation we can
go for abstract class.
Example:Servlet API:
HttpServlet is an abstract class in which init() is
implemented used by every servlet that extends.Every
servlet implement their own service method.
| Is This Answer Correct ? | 10 Yes | 0 No |
Post New Answer View All Answers
What is the function of compareto in java?
What do you understand by java?
Can size_t be negative?
How to sort an array in java without using sort method?
What is the difference between choice and list?
Is there a case when finally will not execute?
What is byte value?
Is sizeof a keyword in java programming?
What does index mean in java?
What is the difference between overriding & overloading?
Explain illegalmonitorstateexception and when it will be thrown?
Explain notify() method of object class ?
What is hashing principle in java?
what are abstract functions?
Can I override protected method in java?