Difference between Abstract class and Interface java

By | May 26, 2014

This is another common interview question asked to candidates from java background.Mostly candidates know the answer because they have already read that . But when the interviewers ask them some surrounding questions they fail.

In this article we have answered the basic and some surrounding questions. If you know these hopefully you will be able to ask all the questions.

Abstract class and Interface java

  • Always remember the main purpose of an abstract class is to abstract some of the functionalities , which the classes extending that abstract class should implement . You can still create instances of an abstract class.An interface is not meant to be instantiated . Its a kind of standard methods which every class implementing that interface should implement
  • You can not have method definitions in an interface while you can have them in an abstract class
  • All variables in an interface are static final , that’ not true for variables defined in an abstract class
  • A class can implement multiple interfaces while it can inherit only one abstract class

Surrounding Questions
Refer these articles to see common questions asked on interfaces and abstract classes.
Abstract Class Common Interview Questions
Interface Common Interview Questions

Leave a Reply

Your email address will not be published. Required fields are marked *