File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes bitwise operator 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 "bitwise operator" Watch "bitwise operator" New topic
Author

bitwise operator

prafulla shrikhande
Greenhorn

Joined: Mar 12, 2003
Posts: 4
this was a good one on bitwise operators -

i = 1;

i <<= 31;
i >>= 31;
i >>= 1;

whats the value of i?
Pedro Ivo Dantas
Greenhorn

Joined: Sep 03, 2004
Posts: 10
It depends on the type of the variable i. If it is a int, as I suppose was your intention, then the resulting value will be -1 (11111...1111). If it is a long, then the result will be 0.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: bitwise operator