File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes operator precedence Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "operator precedence" Watch "operator precedence" New topic

operator precedence

Sasikanth Malladi
Ranch Hand

Joined: Nov 04, 2000
Posts: 175
Hi, All!
Is it necessary for the purpose of the exam to memorize operator precedence? Can anyone who's already taken the exam answer?
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
My face turns red when I had a doubt like yours. Who in the world will memorize the precedence. We can always put ( ) to make out code more clear and the precedence we want.
But I had to accept. In order to elminate the risk of getting a possible qstn on this I studied the precedence before the exam. But I DID NOT get a qstn on this in my exam. Others can comment on this.
maha anna
Sasikanth Malladi
Ranch Hand

Joined: Nov 04, 2000
Posts: 175
Hmm, looks like I'll end up memorizing the precedence a day or two before the exam, though I think it's highly absurd to give a question which tests your knowledge of order of precedence (which perhaps makes it a likely question on the exam! :-0)

Joined: Nov 05, 2000
Posts: 14
I have seen this sort of sample question -
What the output be?
System.out.println(5 + 3 * 4 / 2);
So in order to give answer to this sort of tricky question we have to memorise. Keep this plan for the previous 5 days of the exam.
Sahir Shah
Ranch Hand

Joined: Nov 05, 2000
Posts: 158
What if you get a question like this.
public class BitShiftTest{
public static void main(String args[])
int n = 7;
n <<= 3;<br /> n = n & n + 1 | n + 2 ^ n + 3;<br /> n >>= 2;
what value will this print ? (choice 56, 7 , 14 , 24)

Every one knows the arithmetic operator precedence rules. How many people can remember the bitwise operator precedence rules . I did not find anything about this in the JLS. Had to find out the hard way. Incidentally its the same rules as that of boolean algebra.
Good luck.

[This message has been edited by Sahir Shah (edited November 08, 2000).]

Kourosh Keshavarzi
Ranch Hand

Joined: Oct 23, 2000
Posts: 66
I think its extremley important to memorize them.
First of all I got lost of question on this on several
mock exams. And I feel like your chances of geting one
is 50/50. It will only tak you 20 minuits to memorize them
forever. Even if you get just one question on it the 20 miniuts will be more than worth it.
Second of all I can tell you that in the real world you come
across lots of crazy code. Its not just a matter of what
code you right you'll be enhancing and debugging other peoples code as well.
Just do it
I agree. Here's the link:
subject: operator precedence
It's not a secret anymore!