Casting can be used on primitives or instances to convert the current type. There are two types of casts, implicit and explicit.
An implicit cast is legal at runtime, becuase the subclass value is converted to that of its superclass. In general, you can have an implicit cast when a widening conversion is done. An implicit cast requires no additional syntax within the code.
An explicit cast, on the other hand, is when a superclass value is converted to a subclass type. In general, an explicit cast is a narrowing conversion is done. For primitives, narrowing means loss of precision, and for objects it means loss of generality.