Type Checking

Compiler allows method calls and assignments based on compile-time type of variable.
So if we define a variable with the name of its superclass, and we call its unique method, compiling will fail.
Same as above, if we straightly assign sl to vsl2, it will not work, although they have same dynamic type.

Expressions has compile-time type! A compile-time type of a function is the type of its return value.

But in run-time, the type could be its subclass, which is called covariant return types. So when coding, the return type could be the subclass but parameters should be the same, it also perceive as override. This is Covariant Return Types

^hln5l8

Casting

Java has a special syntax for forcing the compile-time type of any expression. “A way to trick the compiler”:
If at runtime, the type is not right(e.g We try to cast a Malamute to a poodle), program will crush.