Is there something like instanceOf(Class c) in Java?

Class.isInstance does what you want.

if (Point.class.isInstance(someObj)){
    ...
}

Of course, you shouldn’t use it if you could use instanceof instead, but for reflection scenarios it often comes in handy.

Leave a Comment