1. Super classes and sub classes

shape
Figure 1. Superclass and subclasses [1].
  • Super class and sub class

  • Avoid redundancy

  • is-a relationship, generalization vs specialization, UML notation

  • Visibility of members in super class

  • Example: implementation of class diagram

2. The super keyword

  • Example: Persons at university Lesson demo in student repository

  • Draw class hierarchy for Student, Lecturer, GraduateStudent, Person

  • Calling super class constructors

  • this vs super

  • Constructor chaining

  • Calling superclass method

3. Overriding methods

  • The Object class and toString() method

  • The Object class and equals() method

4. Polymorphism and dynamic binding

  • Create Person objects in the PersonFactory

  • Static vs Dynamic type (in book these are resp. called Declared type and Actual type)

  • Compiler only knows static type

  • Casting Objects and the instanceof operator

5. ArrayList class

6. Protected data and methods

VisibilityMatrix
Figure 2. Visibility matrix [2].
  • Visibility matrix


1. Liang, Y Daniel. Intro to Java Programming, Comprehensive Version, Global Edition, 10th Edition. Pearson (Intl), 11/2014. VitalBook file.
2. Liang, Y Daniel. Intro to Java Programming, Comprehensive Version, Global Edition, 10th Edition. Pearson (Intl), 11/2014. VitalBook file.