📅  最后修改于: 2022-03-11 14:52:36.263000             🧑  作者: Mango
public class MyClass{
//...
}
Object m=new MyClass();
Object o=new Object();
boolean mInstanceOf=m instanceof MyClass;//true
boolean oInstanceOf=o instanceof MyClass;//false
boolean misInstance=MyClass.class.isInstance(m);//true
boolean oisInstance=MyClass.class.isInstance(o);//false