code.org Notes
Notes from code.org lessons.
Class header:
public class ClassName {
}
Main method:
public static void main(String[] args) {
}
Create an object with: ClassName objectName = new ClassName();
Subclass: Inherits the behaviors and attributes of a superclass
Inheritance: The subclass inherits the behaviors and attributes of the superclass
To extend a class, type: public class [subclass] extends [superclass]
Inside the extended class, you need to create the constructor signature for the subclass, and type super()
to call the superclass constructor and methods.
Like this:
public class PainterPlus extends Painter {
public PainterPlus() {
super();
}
}