The following code snippet will result in a run-time:
class Vehicle { public void printSound() { System.out.print(\"vehicle\"); } } class Ca
This is a runtime error because you already defined the variable v as a Car. You cannot convert Car to Bike.
v
Car
Bike
The compiler will not check this kind of value assignment because compilers in general do not check semantics.