aspose file tools*
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 Spring in Action this week in the Spring 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: 9304
    
  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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why does System.out.println( ~4 ) equal -5 ?