Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Shift by -ve value

 
geetha nagarajan
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3271
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic