aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes &sim 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 "&sim" Watch "&sim" New topic
Author

&sim

Tim Moore
Greenhorn

Joined: Jul 07, 2003
Posts: 17
I have seen something in some practice certification exams and I have no idea what it means. Can you tell me what &sim means and what it is used for?
Thanks,
TM
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

its the bitwise complement operator. Check out the JLS: �15.15.5
(basically you flip all the bits, if its a 0 make it a 1 and vice-versa. NOTE this is different than the '-' operator where you take the two's complement -- flip the bits and add 1)


- Jess
Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
Tim Moore
Greenhorn

Joined: Jul 07, 2003
Posts: 17
Thanks Jessica,
One more question. Why don't they just use the ~ operator?
TM
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Tim, for many of us, it looks like the "~" operator is what you were asking about in the first place. That's because our browsers have interpreted what you wrote as HTML. You typed "&sim" and it came out "~". That's because "∼" is an HTML character entity for the ~ symbol. It's supposed to have that final ; to make it a proper char entity, but due to the sorry lack of standardization in the HTML world, poorly-written stuff like "&sim" is often tolerated. Some browsers will translate it, some won't. You must have seen a sample test written by someone who didn't know how to write proper HTML, and your browser presented the "raw" &sim rather than the parsed ~. Just pretend they wrote ~ in the first place; that's what they meant. This actually has nothing to do with Java; it's an HTML issue.
[ August 11, 2003: Message edited by: Jim Yingst ]

"I'm not back." - Bill Harding, Twister
Tim Moore
Greenhorn

Joined: Jul 07, 2003
Posts: 17
OK, thanks. Does this mean I won't have to worry about knowing what &sim, > and & are on the certification exam, and that the actual symbol will be displayed?
Thanks,
Tim
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

yes the actual symbol will be displayed (so it will look just like if you were coding it)
Tim Moore
Greenhorn

Joined: Jul 07, 2003
Posts: 17
Thanks.
TM
 
 
subject: &sim