Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

instanceof

Does anyone know the answer to this?
Suppose r contains a reference to a new Rectangle(5, 10, 20, 30). Which of these conditions return true?
a) r instanceof Rectangle
b) r instanceof Shape
c) r instanceof Point
d) r instanceof Object
e) r instanceof ActionListener
f) r instanceof Serializable
[324 byte] By [Mrnewbie] at [2007-11-11 6:49:10]
# 1 Re: instanceof
you need to specify how your class hierarchy is
chimps at 2007-11-11 22:40:17 >
# 2 Re: instanceof
a) r instanceof Rectangle - true
b) r instanceof Shape - true
c) r instanceof Point - false
d) r instanceof Object - true
e) r instanceof ActionListener - false
f) r instanceof Serializable - true
sjalle at 2007-11-11 22:41:11 >