This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes confused 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 "confused" Watch "confused" New topic


zaghal mohd
Ranch Hand

Joined: Jun 27, 2002
Posts: 43
Could you pleas help me to understand this question?

-11 10
why its not 10 -10
thanks in advs......

Dan Chisholm
Ranch Hand

Joined: Jul 02, 2002
Posts: 1865
Here's a program that I wrote this morning for the next version of my mock exam.

It prints true,true.
If you want to calculate the negative of any number in two's compliment format, then invert the bits and add one. The ~ operator inverts the bits.

Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="" target="_blank" rel="nofollow">Try my mock exam.</a>
zaghal mohd
Ranch Hand

Joined: Jun 27, 2002
Posts: 43
Thanks you dan you are doing well in your mock exams good luck and thanks again
Charu Murali
Ranch Hand

Joined: Jul 12, 2002
Posts: 37
You can easily remember the function of ~ operator as " ~X = (-X)-1 ". So in your question ~10 = (-10)-1 = -11.

I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: confused
It's not a secret anymore!