Consider the simplest possible example. We have
public class Foo {}
Therefore we can say
Foo.class // ==> class Foo
It therefore stands to reason that Foo
should be a java.lang.Class
, as we clearly have access to it and can manipulate it in the current context. Yet
Foo instanceof java.lang.Class
raises the error
cannot find symbol
symbol: variable Foo
Foo instanceof java.lang.Class
^-^
This isn't anything to do with instanceof itself, though; just
Foo
alone in the OpenJDK shell produces the same error.
How can we be accessing properties on Foo
if Foo
does not exist in the current context?