What is the `instanceof` operator used for in Java?

Java Associate Medium

Java Associate — Medium

What is the `instanceof` operator used for in Java?

Key points

  • `instanceof` is used for runtime type-checking
  • It helps ensure safe casting of objects
  • Useful for determining class relationships dynamically

Ready to go further?

Related questions