← BYTES
Java·Starter·Ref: 9.1.9
What does the `instanceof` operator check?
Have a question about this video? Mention reference 9.1.9 when you contact us.
a.Whether two references point to the same object
b.Whether an object is an instance of a given class or implements a given interface
c.Whether a variable is null
d.Whether two objects are equal by value
`obj instanceof SomeType` returns true if `obj` is actually an instance of `SomeType` (or a subtype of it, or implements it if it's an interface) -- commonly used before a downcast to avoid a ClassCastException.
Find this on YouTube & Instagram
Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:
#BYTES#BYTES919#Java