• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Difference between instanceof and instanceOf

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

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 ??

Thanks

Neju
 
Ranch Hand
Posts: 38
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

and other one instanceOf ??


And where did you find the other one ?
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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..
 
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Najmunnisa Sageer
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

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.

Neju.
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The question is actually about the difference between instanceof and instanceOf and not instanceof and .class/.getClass()...
 
reply
    Bookmark Topic Watch Topic
  • New Topic