• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

InstanceOf

 
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Folks

I am littlebit confuse with the following code:-

class Ex
{
public static void main(String args[])
{
short s=15;
Boolean b;
// insert code here
}
}

Correct Options: -

a) b=( S instanceof s);
b) b=( S instanceof Number);

I am Ok with option A but option B I can't understand please explain it.





[ May 01, 2007: Message edited by: Gaurav Pavan Kumar Jain ]
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's instanceof; not instanceOf or instance of. Please show some care for your readers by spelling the operator correctly.

It's s not S. This " S instanceof s" is also nonsense.

Code like this is just a waste of a person's time and it is not worth spending any effort to help you.
[ May 01, 2007: Message edited by: Barry Gaunt ]
 
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Barry Gaunt wrote

Code like this is just a waste of a person's time and it is not worth spending any effort to help you.


Exactly.
 
Ranch Hand
Posts: 37
IntelliJ IDE Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, you best describe the question more clearly
 
The first person to drink cow's milk. That started off as a dare from this tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic