• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Harry Henriques
Ranch Hand
Posts: 206
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


C:\Documents and Settings\Harry Henriques>java Question
-5
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

check this thread: Bitwise Complement
 
Harry Henriques
Ranch Hand
Posts: 206
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Sebastian.




C:\Documents and Settings\Harry Henriques>java Question
-5
-4
-5
 
Ankit Garg
Sheriff
Posts: 9497
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remember that bitwise operators (except | and &) and shift operators are not a part of the SCJP exam...
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic