They are very different.
The
instanceof operator tests whether its left-hand operand can be cast to the class named on its right and returns a
boolean. If the left operand is an object of a subclass of the named class, it still returns
true, and if you write
null instanceof Foo, you always get
false.
I have never seen getclass, but the
Object#getClass() method returns the
Class<?> object which that object was created from. If you call it on any non-
null reference type you get a Class<?> object, but if you call it on a
null reference you suffer a NullPointerException.