Difference between abstract and interface

abstract:

  • abstract keyword is used to declare abstract class.
  • It can have abstract and non-abstract methods.
  • It doesn't support multiple inheritance.
  • It can have final, non-final, static and non-static variables.

Example:

 public abstract class Shape{
public abstract void draw();
}

interface:

  • interface keyword is used to declare interface.
  • It can have only abstract methods.
  • It supports multiple inheritance.
  • It has only static and final variables.

Example: 

public interface Drawable{
void draw();
}
Posted on by