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
Explain the difference between runnable and callable interface in java?
What is reflexive association?
Tell me the latest versions in java related areas?
What do you mean by exception handling in Java?
What are the different types of java?
What is locale in java?
Why hashset is used in java?
Why is singleton instance static?
What is predicate in java?
What is diamond operator in java?
What are three ways in which a thread can enter the waiting state in java programming?
What is the use of arrays tostring () in java?
What is difference between == and === in js?
What is a map? What are the implementations of map?
How to sort an array in java without using sort method?