This keyword is used in a class declaration to indicate that the class inherits from another class.
What is the extends keyword?
This keyword must be the first statement in a subclass constructor to invoke the superclass constructor.
What is super?
To override, the method must have the same signature as the superclass version, including return type.
What is how to override a method?
This keyword calls the immediate superclass's constructor or method.
What is using the super keyword?
This class provides equals(), toString(), and hashCode() methods inherited by all classes.
What is the Object class?
A common superclass example where fields like name and age are defined, often extended by Student or Employee classes.
What is the Person superclass?
Every class implicitly extends this ultimate superclass, which has a no-arg constructor called automatically.
What is the Object class?
When calling overridden methods, this keyword accesses the superclass version from a subclass. (Hint: Not super yet.)
What is method resolution based on reference type?
In the Animal class hierarchy, super.eat() from Dog accesses Animal's eat() method.
What is invoking superclass methods?
By default, toString() returns something like "Person@1b6d3586" with this info.
What is class name @ hashCode (default values)?
In the Vehicle superclass exercise, this class might extend Vehicle and add fields like numberOfWheels.
What is Car?
In the Student subclass, this constructor calls super(name) before setting gradeLevel.
What is the parameterized constructor?
The classic dilemma: If Square extends Rectangle, overriding setWidth to also set height violates this principle.
What is the Liskov Substitution Principle (or Square is-a Rectangle issue)
For Square extending Rectangle, super.setWidth(w) calls Rectangle's version without affecting height.
What is avoiding override side effects?
Override this to return a meaningful string like "x=5, y=3" for a Point class.
What is toString()?
This concept allows a subclass like Computer to inherit methods from a Hardware superclass but override specifics like processSpeed.
What is inheritance?
For the Shape class, if Circle extends Shape, this happens if no super() is explicit: the no-arg superclass constructor is called.
What is an implicit call to super?
In Student toString, this overridden method from Object returns "Name: Alice, GPA: 3.5" instead of memory address.
What is a custom toString implementation?
In "Apple Pie" exercise, Pie subclass uses super(bakeTime) in its constructor.
What is parameter passing to superclass?
For custom equality, override this to compare fields, not just reference equality.
What is equals()?
In the "Exercise: Computers" scenario, if Computer extends Device, this is the relationship where Device provides common methods like powerOn().
What is superclass-subclass hierarchy?
(Daily Double!)
In "Exercise: Clothing Store," a Shirt subclass constructor uses super(size, color) to initialize Item fields before adding fabricType.
What is chaining constructors with super?
(Daily Double!): For "Exercise: Dogs Bark," if Dog overrides Animal's makeSound() to return "Woof!", this ensures polymorphism in an array of Animals.
What is dynamic method dispatch?
In "Exercise: Bank Accounts," SavingsAccount overrides withdraw() but calls super.withdraw(amount) before applying interest.
What is method overriding with super delegation?
n "Exercise: Equal?," two Student objects with same name/GPA return true if equals() overrides Object's version properly.
What is field-based equality overriding?