• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

operator precedence

 
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, All!
Is it necessary for the purpose of the exam to memorize operator precedence? Can anyone who's already taken the exam answer?
Sashi
 
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
regds
maha anna
 
Sasikanth Malladi
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)
shashi
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What if you get a question like this.
<pre>
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;
System.out.println(n);
}
}
what value will this print ? (choice 56, 7 , 14 , 24)
</pre>

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.
Sahir

[This message has been edited by Sahir Shah (edited November 08, 2000).]
 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Kourosh
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic