Programming Tutorials

What is similarities/difference between an Abstract class and Interface?

By: Karthik in Interview Tutorials on 2012-06-16  

Answer: Differences are as follows:

	Interfaces provide a form of multiple inheritance. A class can extend only one other class. 
	Interfaces are limited to public methods and constants with no implementation. Abstract classes can have a partial implementation, protected parts, static methods, etc. 
	A Class may implement several interfaces. But in case of abstract class, a class may extend only one abstract class. 
	Interfaces are slow as it requires extra indirection to to find corresponding method in in the actual class. Abstract classes are fast.  


	Neither Abstract classes or Interface can be instantiated. 

Add Comment

* Required information


No comments yet. Be the first!

Most Viewed Articles (in Interview )

Interview Question: Is there a particularly good IDE to use with Struts ?

Explain the different forms of Polymorphism.

Interview Question: If the framework doesn't do what I want, can I request that a feature be added?

Interview Question: How is the MVC design pattern used in Struts framework?

Interview Question: Do ActionForms have to be true JavaBeans?

Interview Question: What is Deployment descriptor?

Interview Question: What is EJB client JAR file?

What are Access Specifiers available in Java?

Interview Question: Can I invoke Runtime.gc() in an EJB?

Interview Question: What are the optional clauses in EJB QL?

Interview Question: How many EJB Objects are created for a Bean?

What is the difference between Session Bean and Entity Bean?

Types of Interviews

What is similarities/difference between an Abstract class and Interface?

Explain the new Features of JDBC 2.0 Core API?

Latest Articles (in Interview)