Site Map
Useful Tools
Graphing Calc

Scientific Calculator

Interface vs Abstract Class

Interface Abstract Class

What they look like:

  • They are allowed to have abstract methods like getArea() below
  • They can also regular methods
  • They can have instance and static variables.
   public abstract class Shape{
        int color;
        abstract double getArea();
        public int getColor(){
        return color;
What they look like:
  • They can have static variables
  • They cannot have instance variables
  • all methods are public
  • method cannot have a body.
  • Interfaces can actually be abstract!
public interface Mathable{


public String getData();

public boolean isEquivalentTo(Mathable other) ;

How they are the same
neither interfaces nor abstract classes can be instantiated.
new Shape()
new Mathable()