1
I need to create a condition to know if a given object is part of a class that implements a certain interface. How can I do this?
1
I need to create a condition to know if a given object is part of a class that implements a certain interface. How can I do this?
3
Behold that answer also, follows the examples:
interface I1 { }
interface I2 { }
class C implements I1, I2 { }
C c = new C();
boolean isC = (c instanceof C); //true
boolean isI1 = (c instanceof I1); //true
boolean isI2 = (c instanceof I2); //true
Browser other questions tagged java interface
You are not signed in. Login or sign up in order to post.