What is instanceof operator ?
hat is the meaning of instanceof operator ? and Why it is used in OOPS programming ? and How to implement in program ?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
DarilPosted Nov 16, 2021, 7:26 AM
It is used to test if an object/instance is a subtype of a given type. It is a binary operator and returns a boolean value(true/false)
you can use it to find out if an object is an instance of a class.
The output will be "true".
a subcalss's object is also a type of parent calss. Example if bee extends insects then object of bee can be referred by both the bee or insects calss.
Priyanka K SPosted Dec 27, 2019, 5:08 AM