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 about main thread in java?
Is arraylist sorted in java?
Why is boolean important?
What is the meaning of variable in research?
Differentiate between == and equals().
How many types of methods are there in java?
does java support pointers?
What is main string [] args?
What are recursive functions? Give some examples?
What is java beans?
What is the syntax and characteristics of a lambda expression?
State the main difference between c++ and java?
What is a buffer in computer?
Enlist diffrent types of inheritance supported by java?
Explain thread life cycle in java?