So, for example, when one tries to cast an
Integer to a String, String is not an subclass of Integer, so a ClassCastException will be thrown.Object i = Integer.valueOf(42);
String s = (String)i;
No comments:
Post a Comment