158k views
3 votes
What Are The Legal Operands Of The Instanceof Operator?

1 Answer

2 votes

Final answer:

The instanceof operator is used in programming languages like Java to check whether an object belongs to a specific class or implements a specific interface. The legal operands of the instanceof operator in Java are an object reference and a class or interface.

Step-by-step explanation:

The instanceof operator is used in programming languages like Java to check whether an object belongs to a specific class or implements a specific interface. In Java, the legal operands of the instanceof operator are an object reference and a class or interface. The result of the instanceof operator is true if the object is an instance of the specified class or implements the specified interface, otherwise it is false.

User Gul
by
7.2k points