File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in Shift operator

 
R .sourav nayak
Ranch Hand
Posts: 67
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could some explain me how the out put is i =-1 and j=0 from the following code:


public class Q5
{
public static void main(String[] args)
{
int i = 1;
i <<= 31;
i >>= 31;
i >>= 1;

int j = 1;
j >>= 31;
j >>= 31;

System.out.println("i = " +i );
System.out.println("j = " +j);

}
}
thanks in advance.
reena
 
wise owen
Ranch Hand
Posts: 2023
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic