3

New lesson learned: In Java, object creation only happens at runtime.

A a = new B();
a.doSomething();

Compiler steps:
- checks if A exists
- checks if B exists
- checks if B is subclass of A
- compiles (code -> Bytecode)

Runtime:
- checks if B overrides doSomething() of A
- executes the overridden version

Comments
Add Comment