isinstance method in java code example
Example: isinstance java
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