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...?
Cindy Glass
"The Hood"
Sheriff
Joined: Sep 29, 2000
Posts: 8521
posted
0
You need to name the Class or Interface that you are asking if the object is an instance of it. if (myObj instanceof String){ //do something Stringlike }
"JavaRanch, where the deer and the Certified play" - David O'Meara
referenceinstanceofReferenceType ReferenceType can also be an array reference type, e.g. ref instanceof int[] // true if ref is an int[] ReferenceTypecannot be java.lang.Class (compile time error) except when reference is declared as an Object.
------------------ Junilu Lacar Sun Certified Programmer for the Java� 2 Platform