GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  J2EE  >  Java
Go To First  |  Previous Question  |  Next Question 
 Java  |  Question 20 of 921    Print  
What is the difference between the >> and >>> operators
The >> operator carries the sign bit when shifting right. The >>> zero-fills bits that havebeen shifted out.


  
Total Answers and Comments: 3 Last Update: October 05, 2005   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
September 09, 2005 05:12:43   #1  
Joseph Reddy        

RE: What is the difference between the >> and >>> operators
The >> operator causes the bits of the left operand to be shifted to the right, based on the value of the right operand. The bits that fill in the shifted left bits have the value of the leftmost bit (before the shift operation).  
The >>> operator is identical to the >> operator, except that the bits that fill in the shifted left bits have the value of 0. The >>> operator is said to be an unsigned shift because it does not preserve the sign of 
the operand.

 
Is this answer useful? Yes | No
October 02, 2005 07:34:47   #2  
kanniappan        

RE: What is the difference between the >> and >>> oper...

>> : operator once moves the bits towards right. It doesn't move the sign bit.

>>>: operator once moves the bits towards right, the sign bit also will gets moving.


 
Is this answer useful? Yes | No
October 05, 2005 17:33:57   #3  
infant Member Since: October 2005   Contribution: 1    

RE: What is the difference between the >> and >>> oper...

While dealing with (+)ve numbers there is no difference between >>> and >> operators.Both operators shift zeros into the upper bits of a number.

The difference arises when dealing with (-)ve numbers.Since (-)ve numbers,(-)ve numbers have their high order bit set to 1.The >>> (Zero Fill Shift Operator) shifts zeros into all the upper bits,INCLUDING THE HIGH ORDER BIT,Thus making the (-)ve number into a (+)ve number.


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape