Always try to test null pointer and test casting available in the codes.
If null, or failed to cast, simply printing out some error message would be much better than the runtime exception thrown by JVM.
If null, or failed to cast, simply printing out some error message would be much better than the runtime exception thrown by JVM.