What is difference between instanceof and isInstance(Object obj)?
Question
What is difference between instanceof and isInstance(Object obj)?
Answer
Differences are as follows:
- instanceof is a reserved word of Java, but isInstance(Object obj) is a method of java.lang.Class.
- instanceof is used of identify whether the object is type of a particular class or its subclass but isInstance(obj) is used to identify object of a particular class.
š² Practice Offline on Mobile: Download the free QA Automation & SDET Prep app on Google Play & App Store.