File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Difference between instanceof and instanceOf Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Difference between instanceof and instanceOf" Watch "Difference between instanceof and instanceOf" New topic

Difference between instanceof and instanceOf

Najmunnisa Sageer

Joined: May 18, 2008
Posts: 9

Can anyone help me to differentiate between instanceof and instanceOf operators.

I know that the instanceof operator is used for checking an object is of particular type and its used for object reference variables only and other one instanceOf ??


Meena Ajay
Ranch Hand

Joined: May 28, 2008
Posts: 38

I have not read about instanceOf with a capital 'O'.I think we have only one instanceof operator.As you said, the instanceof operator is used to check if an object is an instance of a specific class or interface.

Cheers, Meena
Amit Ghorpade

Joined: Jun 06, 2007
Posts: 2851

and other one instanceOf ??

And where did you find the other one ?

|Asking Good Questions|
Sunil Belurgikar

Joined: May 21, 2008
Posts: 14
instanceOf with capital O can be used as variable name.
Exam creators use this to confuse you.
instanceof is java keyword which checks if perticular object is instance of the type..

SCJP 1.6
Raphael Rabadan
Ranch Hand

Joined: Jul 05, 2008
Posts: 141
You might be doing whizlabs exam. It's there where I saw a questions like this. instanceOf isn't a keyword, you can use it as class name, variable name or anything.

SCJP Java 6 (98%) - Story, SCJA (88%) - Story
Najmunnisa Sageer

Joined: May 18, 2008
Posts: 9

I had a doubt when I was reading our Scjp Faq(under the topic:What are some potential trips/traps in the SCJP exam? )
Now its cleared.

Thanks to all of you.

Ramakrishna Konanki

Joined: Apr 18, 2008
Posts: 20
Ankit Garg

Joined: Aug 03, 2008
Posts: 9462

The question is actually about the difference between instanceof and instanceOf and not instanceof and .class/.getClass()...

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
I agree. Here's the link:
subject: Difference between instanceof and instanceOf
It's not a secret anymore!