instanceof和isInstance区别详解

对obj.instanceof(class),在编译时编译器需要知道类的具体类型

对class.isInstance(obj),编译器在运行时才进行类型检查,故可用于反射,泛型中
 

你可能感兴趣的:(JAVA)