• Use inheritance in creating classes
  • If no default constructor is present in the superclass, explain why a constructor of a subclass should make an explicit call to a constructor of the superclass
  • Explain what is meant by "overriding a method"
  • Make use of super reference to call a parent method from within a method that overrides it
  • Implement source code that meets the design specified in a UML class diagram

Note taking requirement

Don't forget to submit your notes in Canvas prior to classtime.

Reading

Shape Class Introduction [7:05]

  • What is a parent class?
  • Give an example of a parent class?
  • What is a child class?
  • Give an example of a child class?
  • What are the two key reasons for using inheritance?

Shape Class Code [9:39]

  • Compare UML diagram to source code.
  • Which methods of the actuaully change attributes of the Shape class?
  • What package is the Color class in?
  • What is the Object class?
  • What is the parent class of Shape?

Overriding Methods [3:19]

  • When do we need to call toString() when inside a System.out.println() call?
  • What is different about implementing toString() than other methods in the Shape class?
  • How do you set a breakpoint?
  • How do you run the debugger in IntelliJ?

Child Class Square [6:42]

  • What keyword is used to indicate inheriting from a different class?
  • How do you access parent methods in the child class?
  • What additional instance variables were added to the Square class?
  • How does the constructor of a subclass interact with the constructor(s) of the super class?
  • Which method(s) from the Shape class were overridden in the Square class?
  • When is the default constructor not available?
  • What keyword is used to call a different constructor from a constructor in the same class?

Calling Parent's Constructor [10:45]

  • What keyword is used to call a constructor from the parent class?
  • Note that the constructor from the superclass is executed prior to the subclass' constructor.
  • What attributes from the Shape class are available in Square?
  • If the parent's constructor is not called explicitly, what constuctor gets alled implicitly?

Calling Parent Methods [7:19]

  • What keyword do we use the expiclitly can the parent's implementation of a method?
  • What are some examples of class hierarchies in the Java standard library?
  • What does @Override do?