If you run your program, you'll see that it prints "a" three times, because doStuff() is called on an Animal reference each time. The fact that one of the calls is through a Dog object doesn't matter at all, only the type of the variable. If you understand what overriding is and how it works for non-static methods,
you should understand how this is different.