The following explanation is included with the question:
This question illustrates the fundamental aspect of overriding, which is that it is the actual class of object and not the class of the reference type that determines which instance method will be invoked.
Here, actual class of the object pointed to by w is GoodWidget and so GoodWidget's doWidgetStuff will be invoked. This method does nothing and so nothing is printed. Notice that the explicit cast to Widget has no impact because the class of the reference is not considered while invoking the instance methods at all.
But if you try to access the field (or a static method) directly, the class of the reference is used. Therefore,
Thank you for your feedback. It is true that it illustrates polymorphism. But then it is also true that it illustrates OOP and that it illustrates Java programming.
But the most specific thing that it illustrates is the behavior that you get when you override a method. That is why the explanation mentions overriding instead of other broader concepts.
Another way to look at it is that the link that you quoted mentions multiple ways of achieving polymorphism. This code does not illustrate them all. So to say that this code illustrates polymorphism would be correct but too vague.