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 a class, so the second example doesn't make more sense that the first. You're asking if the instance is an instance of the class, a instanceof Parent
is a pretty direct expression of that.
Parent.class
is an instance of Class
, so even if the second example compiled (it doesn't, the right-hand of instanceof
can't itself be an instance), it wouldn't check what you want it to check. :-)