Superclasses & Subclasses
Constructors in Subclasses
Overriding Methods
The super Keyword
Object Superclass
100

This keyword is used in a class declaration to indicate that the class inherits from another class.

What is the extends keyword?

100

This keyword must be the first statement in a subclass constructor to invoke the superclass constructor.

What is super?

100

To override, the method must have the same signature as the superclass version, including return type.

What is how to override a method?

100

This keyword calls the immediate superclass's constructor or method.

What is using the super keyword?

100

This class provides equals(), toString(), and hashCode() methods inherited by all classes.

What is the Object class?

200

A common superclass example where fields like name and age are defined, often extended by Student or Employee classes.

What is the Person superclass?

200

Every class implicitly extends this ultimate superclass, which has a no-arg constructor called automatically.

What is the Object class?

200

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?

200

In the Animal class hierarchy, super.eat() from Dog accesses Animal's eat() method.

What is invoking superclass methods?

200

By default, toString() returns something like "Person@1b6d3586" with this info.

What is class name @ hashCode (default values)?

300

In the Vehicle superclass exercise, this class might extend Vehicle and add fields like numberOfWheels.

What is Car?

300

In the Student subclass, this constructor calls super(name) before setting gradeLevel.

What is the parameterized constructor?

300

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)

300

For Square extending Rectangle, super.setWidth(w) calls Rectangle's version without affecting height.

What is avoiding override side effects?

300

Override this to return a meaningful string like "x=5, y=3" for a Point class.

What is toString()?

400

This concept allows a subclass like Computer to inherit methods from a Hardware superclass but override specifics like processSpeed.

What is inheritance?

400

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?

400

In Student toString, this overridden method from Object returns "Name: Alice, GPA: 3.5" instead of memory address.

What is a custom toString implementation?

400

In "Apple Pie" exercise, Pie subclass uses super(bakeTime) in its constructor.

What is parameter passing to superclass?

400

For custom equality, override this to compare fields, not just reference equality.

What is equals()?

500

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?

500

(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?

500

(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?

500

In "Exercise: Bank Accounts," SavingsAccount overrides withdraw() but calls super.withdraw(amount) before applying interest.

What is method overriding with super delegation?

500

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?

M
e
n
u