What is difference between an Abstract class and Interface?

Abstract Class means Blueprint of the model.
Interface and Abstract classes are same functionality and do have similarities and dissimilaties too, beow are some of similarirties and dissimilarities:

Similarity:
Neither Abstract classes or Interface can be instantiated.

Difference:

  1. A Class may implement several interfaces. But in case of abstract class, a class may extend only one abstract class.
  2. Interface have all abstract method, and an abstract class may contain concreate methods to it.
  3. Interfaces are limited to public methods and constants with no implementation. Abstract classes can have a partial implementation, protected parts, static methods.
  4. One Abstract method is required to make a class abstract, and all method should be abstract to make a interface class.
  5. Interface may include CONSTANT.

Interface means functionality of the model if the class implements one(an interface). Using Abstract class we can take n number of instances. Like using the Blueprint of a Car we can take n number of similar cars. But we cannot use the Bluprint or model to drive the car.That is the meaning of abstract. So Car is the Blueprint and Ford Car is the derived class from car which uses all the
properties of class and some more properties which is specific to Ford.

Frog is a derived class from Mammal.

When it lives on land it implements the function of hopping.
when it lives on water it implements the function of swimming.
So we find that frog uses both methods hopping and swimming. So it is better to declare in some interface so that any frog which implements the interface will define its own way of transportation.
let me create an Interface called Amphibian and give two method Swimming() and hopping().

It looks like

public interface Amphibian{
public void swim();
public void hop();
}

Let we define the Frog class as
public class Frog implements Amphibian{
public void swim(){
//Define your words
}

public void hop(){
//Define your words
}

}

The above class Frog when implements the interface Amphibian it has to define the methods declared in the interface Amphibian. It can be an empty method. But it should be defined. The use of an interface is any class which wants to use some remote functionalities can implement that particular interface and can perform the task like man using Parachute to fly in air.

Please comment on this to make it more relevant to you…
Regards,
Bhanu Pratap