James Jefferies and ShedCode Ltd

The world of James and ShedCode

Difference Between Instanceof and isInstance

f  you use instanceof or isInstance it will succeed if the class can be ‘upcast’, so if it inherits from what you’re comparing it to..

classA instanceof classB

is true if classA is of a type inherited from classB


isInstance allows you to do it dynamically though