What is the difference between these two casting methods in Java?
The source is Class#cast(Object)as follows:
public T cast(Object obj) {
if (obj != null && !isInstance(obj))
throw new ClassCastException();
return (T) obj;
}
So, castbasically it is the general wrapper of a translation operation, but I still don't understand why you need a method for it.
source
share