Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Question: What is the 'instanceof' operator used for?
Answer: The 'instanceof' operator in Java is used to test if an object is an instance of a particular class or interface. It returns true if the object is an instance; otherwise, it returns false.

Example:

if (obj instanceof MyClass) { /* do something */ }
Is it helpful? Yes No

Most helpful rated by users:

©2025 WithoutBook