// Creating a class
public class MyNeighborhood {
    public static void main(String[] args) {
  
      // Creating an Object
      Painter myPainter = new Painter();

      // calling a method using dot notation
      myPainter.move();
      myPainter.turnLeft();
      
    }
  }
// Extend a superclass to the subclass
// A.K.A. Inheritance
public class PainterPlus extends Painter {

    public PainterPlus() {
      super();
    }

  }

Inheritance

  • Inheritance allows us to "inherit" the methods and attributes of the superclass to the subclass
// Formatting for inheritance
public class subclass extends superclass {
    // code here
}