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 Shift by -ve value 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 "Shift by -ve value" Watch "Shift by -ve value" New topic
Author

Shift by -ve value

geetha nagarajan
Ranch Hand

Joined: Jul 13, 2001
Posts: 94
Why is the shift operation by a -ve value ,not a compiler error.(eg: 12 >> -2)?
It compiles fine and gives 0 as o/p.
Pl.clarify.
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
Doing a shift by a negative number is not a compiler error. It is a legal operation in Java. Do a search in this forum as this topic has been discussed many times.
Corey


SCJP Tipline, etc.
 
jQuery in Action, 2nd edition
 
subject: Shift by -ve value