A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Java SE 8 for the Really Impatient
this week in the
Joined: May 11, 2001
Nov 06, 2001 13:50:00
There must be a reference type after the instanceof operator.
By 'reference type', you mean something like Object, and not the variable representing an Object...?
Joined: Sep 29, 2000
Nov 06, 2001 14:07:00
You need to name the Class or Interface that you are asking if the object is an instance of it.
if (myObj instanceof
//do something Stringlike
"JavaRanch, where the deer and the Certified play" - David O'Meara
Joined: Feb 26, 2001
Nov 06, 2001 14:42:00
can also be an array reference type, e.g.
ref instanceof int // true if ref is an int
(compile time error) except when
is declared as an Object.
Sun Certified Programmer for the Java� 2 Platform
Junilu - [
How to Ask Questions
How to Answer Questions
I agree. Here's the link:
subject: instanceof operator
Test Question - Explanation?
Instance Of operator
Wrapping from Integer to int possible?
Difference between instanceof and instanceOf
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014