[Solved] When I cast object to its supertype do I access the original or overriden methods?


Output will obviously correspond to

System.out.println("You are NOT welcome, "+name+"!");

having the subclass method is superclass will only allow your code to compile.

i.e test.hello("Tomáš"); after type cast.

However at runtime method of Greeter_mean is called as the instance if really of type Greeter_mean.

solved When I cast object to its supertype do I access the original or overriden methods?