This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes &sim operator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "&sim operator" Watch "&sim operator" New topic
Author

&sim operator

Christoffer Jeffson
Greenhorn

Joined: May 22, 2002
Posts: 5
I took one of the many tests out there and got this question:

Which of the following lines of code, considered individually, compile(s) without error? Choose all correct options.
A) int i=1; int j = &simi;
B) int i=1; int j = !i;
C) boolean b = true; boolean c = &simb;
D) boolean b = true; boolean c = !b;

I had no idea the &sim operator existed, so I answered D. But apparently, this was the correct answer:

Correct selection is: A, D
The &simoperator performs bitwise inversion on integral types; it may not be applied to boolean data. The ! operator inverts boolean values; it may not be applied to integral types.

Can anyone explain what the &sim operator is? Where can I find more information on it? Are there more operators like this one?
--
Christoffer
Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2578

Are you talking abt ~ operator?
- Manish
[ May 30, 2002: Message edited by: Manish Hatwalne ]
Jamal Hasanov
Ranch Hand

Joined: Jan 08, 2002
Posts: 411
Hi, Christoffer
You answered correct - A is wrong answer!
There is no sim operator in Java ! Try compile this code and you'll be sure in this.
Where you found this test? This is not correct test.
Jamal Hasanov
www.j-think.com
Christoffer Jeffson
Greenhorn

Joined: May 22, 2002
Posts: 5
Ah, it must have been the ~ operator. The makers must have forgot the ; when typing ∼
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4442
    
    5

This is a known error in one of the RHE mock exams. Look in the errata forum.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: &sim operator
 
Similar Threads
operators
Simon Roberts - Bonus 2 -#19
&sim ???
Please help
What is the &sim operator