When you assign an object of type Moof to the Object o, you don't really change the type of the actual object, you change just the type of a variable that refers to it. The real type of the object remains the same. The ability to refer to the subclass object using a superclass variable is the essense of
polymorphism.
But how to define the real type of the object to which the "o" variable is referring? That's where you use the instanceof operator. During runtime, it checks that the actual type of the object is Moof, and as it is, the operator returns true.