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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Operator precedence" Watch "Operator precedence" New topic

Operator precedence

Greg Charles

Joined: Oct 01, 2001
Posts: 2968

How much does SCP 1.4 depend on knowing operator precedence? I don't see it listed among the exam objectives, but some of the questions in the K&B Self Test for Chapter 3 rely on, for example, knowing that && has a higher precedence than || and knowing that + is evaluated left to right. Does the real exam also require you to know that?
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
I don't remember exactly - I would say the 1.4 exam does not require extensive knowledge of the precedence of all operators. Or if it does, I didn't happen to get those questions when I took the exam. Personally I just remember that * and / are before + and -, which are before any relational operators, which are before && which is before ||. So I can correctly evaluate something like

if (x + 2 * y > 7 || x < 0 && y == 0)

though in real life of course I'd want some parens in there.

That's probably more than you need to know for the exam, but my point is that if the exam had required more than that from me, I'd probably remember that fact now. The exam probably doesn't expect you to know that && is before ||, and may well require less than that - but I couldn't say how much less.

Hope that helps...
[ March 10, 2006: Message edited by: Jim Yingst ]

"I'm not back." - Bill Harding, Twister
I agree. Here's the link:
subject: Operator precedence
It's not a secret anymore!