wood burning stoves*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes shift operator que. ! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "shift operator que. !" Watch "shift operator que. !" New topic
Author

shift operator que. !

Ashok Paulraj
Ranch Hand

Joined: Jul 07, 2003
Posts: 78
Ranchers,
I knew how to arrive at the solution for the below question but it will involve a big no. @ the end through an intensive calculation with powers of 2.
does the exam will have such questions ?
public class NegativeShift
{
public static void main(String[] args)
{
System.out.println(-3 >>> 1);4.
}
}
~ Shalini
Vicken Karaoghlanian
Ranch Hand

Joined: Jul 21, 2003
Posts: 522
Taurean, Sun does not expect from you to be a human calculator. The difficulty of the question is determined by its choices.
The question you posted may have smart multiple choices, for example; we all know that the output is
0111 1111 1111 1111 1111 1111 1111 1110
Correct choices may include:
1) Integer.MAX_VALUE - 1
2) 7FFF FFFE
3) (2^31) - 2

Hope this helps.


- Do not try and bend the spoon. That's impossible. Instead, only try to realize the truth. <br />- What truth? <br />- That there is no spoon!!!
 
Consider Paul's rocket mass heater.
 
subject: shift operator que. !