Yes. Not only is the order not the same, but object instanceof Clazz
must have a class which is known at compile time. clazz.isInstance(object)
can take a class which is known at runtime.
There is also subtle difference in that isInstance will auto-box, but instanceof will not.
e.g.
10 instanceof Integer // does not compile
Integer.class.isInstance(10) // returns true
Integer i = 10;
if (i instanceof String) // does NOT compile
if (String.class.isInstance(i)) // is false
To see the difference I suggest you try to use them.
Note: if you do object.getClass().getClass()
or myClass.getClass()
you will just get a Class
Be careful not to call getClass()
when you don't need to.