Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

&sim

 
Tim Moore
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
Tim Moore
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jessica,
One more question. Why don't they just use the ~ operator?
TM
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Tim Moore
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes the actual symbol will be displayed (so it will look just like if you were coding it)
 
Tim Moore
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
TM
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic