I am just curious to ask this, maybe it is quite meaningless.
When we are using instanceof in java, like:
if (a instanceof Parent){ //\"Parent\" here is
Parent
is the name of a type. Parent.class
is essentially a static variable that refers to an object (specifically, an instance of Class
). You want to ask whether a
is an instance of the Parent
type, not whether it's an instance of an object that is itself an instance of some other type (named Class
).