This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Why does System.out.println( ~4 ) equal -5 ? 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 "Why does System.out.println( ~4 ) equal -5 ?" Watch "Why does System.out.println( ~4 ) equal -5 ?" New topic
Author

Why does System.out.println( ~4 ) equal -5 ?

Harry Henriques
Ranch Hand

Joined: Jun 17, 2009
Posts: 206


C:\Documents and Settings\Harry Henriques>java Question
-5
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
Hi,

check this thread: Bitwise Complement


JDBCSupport - An easy to use, light-weight JDBC framework -
Harry Henriques
Ranch Hand

Joined: Jun 17, 2009
Posts: 206
Thanks Sebastian.




C:\Documents and Settings\Harry Henriques>java Question
-5
-4
-5
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9303
    
  17

Remember that bitwise operators (except | and &) and shift operators are not a part of the SCJP exam...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
GeeCON Prague 2014
 
subject: Why does System.out.println( ~4 ) equal -5 ?