 In the preceding video, we used instance of to check an object's runtime type before casting it to the type we needed to make the compiler happy. You might have been wondering what the limits are on casting, if any. Let's find out. In this program, I've created a geometric object, a circle, and a rectangle. In this example, I'm taking the circle and casting it to geometric object, which has a getArea method that returns zero. The compiler is happy with this. What's going to happen when I run this program? Am I going to get a zero, which is the result of geometric objects, getArea method? Or will I get a number that's not equal to zero because at runtime I still have a circle with a radius of three? Let's find out. And the answer is you can't fool the Java virtual machine runtime. It knows at runtime that the object is still a circle and it still calls circles getArea method. Now let's try casting a superclass to a subclass. In this case, I'm taking the geometric object and telling the compiler to treat it as a circle and then do a getArea. Let's see what happens now. The compiler likes it, but at runtime the Java virtual machine tells me that a geometric object cannot be cast to a circle. Finally, what happens when we try to cast one subclass to another subclass? In this case, I'm attempting to cast a circle object to a rectangle class. And the compiler will tell us, no, you can't do that, these are incompatible types. The moral of the story? Always use instance of to make sure that you are casting to an object's correct class at runtime.