00 - In memoriam George Orwell
01 - Objects/Instances vs. Types/Classes
02 - Members/Fields
03 - Constructor (special method executed once during instance creation)
04 - Methods (behavior of objects)
05 - A second Type/Class Food
06 - Inheritance (modeling a hierarchy of Food varieties) introducing
"super" and "extends" concepts/keywords
07 - final keyword to mark members/fields non-mutable after initial
assignment (Food does not change calories after the Food instance has
been created)
08 - Constructor overloading (Some apple instances can have larger
amounts of calories). Introduces "this" keyword.
09 - Call by value and call by reference (primitive types always call by
value, capital/non-primitive types call by reference)
10 - Refactor Dog and extract Superclass (a base type) out of Dog.
Create type/class Sheep.
11 - Dog instances seen as base type Mammal cannot bark(). Explicit cast
to Dog needed.
12 - Overriding a member method in Sheep to change behavior of Sheep to
not accept Beef as food. Introduces "instanceof" operator.
13 - Overriding a member method in Sheep to change behavior of Sheep to
not accept Beef as food. Delegate to super implementation of member
method.
14 - Sheep throws an Exception when feed with Beef. Introduces "throw"
keyword. Code does not compile intentional to show that subclasses
cannot alter the signature of a member method!!!
15 - Let DisgustingException extend RuntimeException to show the
difference between "checked" and "unchecked" exceptions. Fixes previous
compiler error too!!!
16 - Handle exception with try/catch block to keep MyProgramm from
terminating when Sheep is incorrectly feed with a non-vegetarian Food.
Introduces "try" and "catch" keywords.
18 - Abstract types can declare abstract methods subclasses then are
forced to implement. Introduces "abstract" keyword on member (instead of
class) level
19 - Extend class hierarchy with a type Vegetarian as common base for
Sheep and Cow. Vegetarian defines isVegetarian member method. Sheep and
Cow thus inherit isVegetarian method and do not need to redeclare.
20 - Dog type/class now implements the Interface Omnivore. Mammal checks
if Mammal instance fed is of type Omnivore and only then allows Beef as
Food. Introduces "implements" keywords and concept of (behavior free
marker) Interfaces".