I wonder if anyone could tell me how casting works? I understand when I should do it, but not really how it works. On primitive data types I understand partially bu
The right way is this:
Integer i = Integer.class.cast(obj);
The method cast() is a much safer alternative to compile-time casting.
cast()