This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara 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


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
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: 9293
    
  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
 
wood burning stoves
 
subject: Why does System.out.println( ~4 ) equal -5 ?