Inheritance in a nutshell:

スクリーンショット 2025-03-01 16.11.54.png

Some key vocabularies that you have to memorize:

  1. Override → Redefining the superclass’s method in subclass. Be careful not to confuse with overload, which is a process of making sure a method works properly with different types of input values.
  2. Encampsulation→ It is basically a process where developers protect certain variables and methods from being accessed by other classes.
  3. Polymorphism→ Same method, different actions depending on the type of the class.
  4. Instantiate→ An act of creating a new object/class.
  5. Mutable→ Can change after declaration!!
  6. Immutable→ Cannot be changed after declaration
  7. aliasing→ Two or more variables referencing the same object.

AP Computer Science A Unit 9 Flashcards

Best practices

There is a important practice of providing default constructors in Java, so that the class is initialized properly. This is because when you omit a class constructor, java compiler automatically assumes that there is a default constructor, and this could mess up with values.