Inheritance lets us define classes as extensions of other classes. It lets us:
<aside> ⚙️ Method lookup algorithm ⚙
QUIZ: Create class, create toString() but don’t override it, call on it and see the result.
the default implementation of
toString()which is inherited by every class that extends Object, i.e., every class that doesn’t extend anything else. It looks like a combination of the class name and a unique ID, doesn’t it
// In other words if we print an object without overriding the toString() method then we get a useless hodge podge of letters and numbers.
// A zero parameter constructor (constructor with no parameters) is not the same as a default constructor (we don’t write one at all, Java fills in one with a default values to the super constructor) are not the same
The closer the inheritance relationship is supported by the protected access.
Stronger than public but not Fully private.
protected classes can be accessed by subclasses (children) of the same package.