nullをキャストしてもエラーにならない。
nullをキャストしてもエラーにならない。
Object o = null;
String s = (String)o; //OK!
Object o2 = new Object();
String s2 = (String)o2; //ClassCastException
Integer i = null;
String s3 = (String)i; //compile error.