A cast operation allows an object to be "converted" from one type to another. The compiler raises an error if it can determine that the target type
is incompatible with the declared type of the object, otherwise it accepts the cast. However, depending on the actual runtime type of the object, a
cast operation may fail at runtime. When a cast operation fails, a ClassCastException
is thrown.
What is the potential impact?
This type of exception is usually unexpected. It causes the program to crash or puts it into an inconsistent state. Therefore, this issue might
impact the availability and reliability of your application, or even result in data loss.