Cosmic Q&A
What is the instanceof operator in Java?
Answer
instanceof operator is used for type safety checking. Using instanceof operator we can check whether the given object is an instance of a particular class or subclass or interface. For instance if we have an object of class Animal, we can check whether that object is a Cat or a Dog, using instanceof operator.
Share this page:
Report Error in Content