Ans:
for more answers click here
- instanceof is used to check to see if an object can be cast into a specified type without throwing a cast class exception.
- isInstance() determines if the specified object is assignment-compatible with the object represented by this Class.
- This method is the dynamic equivalent of the Java language instanceof operator.
- The method returns true if the specified Object argument is nonnull and can be cast to the reference type represented by this Class object without raising a ClassCastException. It returns false
- In instanceof operator You can compare it to a named type only, and not to a Class object.
- isInstance remove this problem and call instanceof operator dynamically.
for more answers click here