downcasting

How to downcast a Java object?

Hello, I am trying to understand Java's polymorphism, and I have one question about downcasting an object. Let's say for this example I have two subclasses Dog and Cat that inherit from a superclass Animal From what I understood, the only way to downcast an object is if this Object is already of the good type, like this: Animal a = ne...