Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

HFE PAGE 430:QUESTION 17

 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what does option A mean...the single_valued_path_expression must have a string value
can anybody explain?
please help
thanks
 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you please post the question?
 
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Pradeep,
To answer this question you should understand IN expressions. An IN expression allows you to determine if a particular string is a member of a set of strings. The IN expression evaluates to true if the string preceding the IN operator is a member of the set of strings following the IN operator or evaluates to false otherwise.
For example:
o.country IN (�UK�, �US�, �France�)
In this case o.country is a single_valued_path_expression. What is a single_valued_path_expression? This is just an expression that evaluated to a single value rather than a collection. In the case of IN expressions it only makes sense that the single_valued_path_expression evaluates to a string value, because you are testing for membership amoung a set of strings. The string that o.country represents is tested for membership in the set of strings that follow the IN.
The following from the spec make help clarify things:

11.2.7.8 In expressions
The syntax for the use of the comparison operator [NOT] IN in a conditional expression is as follows:
single_valued_path_expression [NOT] IN (string-literal [, string-literal]* )
The single_valued_path_expression must have a String value.



Hope this helps.
[ February 13, 2004: Message edited by: Keith Rosenfield ]
[ February 13, 2004: Message edited by: Keith Rosenfield ]
 
There’s no place like 127.0.0.1. But I'll always remember this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic