October 31, 2018

Object Casting in Java

In Java, objects can be cast explicitly and implicitly: implicit casting happens when the source type extends or implements the target type (casting to a superclass or interface). explicit casting has to be done when the source type is extended or implemented by the target type (casting to a subtype).