This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
This is driving me crazy. My compiler doesn't like it if you type something like x+ or -y or var+ or whatever if you're trying to increment. It only accepts stuff like x-- or ++y, and that's what I always would have expected, but this MasterExam software that came with my SCJP2 book CD likes to throw it into questions a lot, and I can believe that the real exam might. However, what really tripped me up is that the practice software seems to think that it is a bona fide statement! What is going on here? This is like the Twilight Zone or something, and I'm taking the exam on Monday, so I'm freaking out about it. The software does seem a little messed up, especially since my copy makes it hard or impossible to go back and view questions in the practice exam after time has already expired. Thus, I can't exactly verify that I wasn't going nuts while taking the exam. (I specifically recall choosing an answer, checking my progress, and then trying other answers until it told me I'd chosen the correct answer, and the correct answer included one of those nasty statements with a single increment operator). Maybe I'm just loco, and should commit myself...or dance naked on the beach in winter.
make sure you let us know what beach and where When in doubt -- check the JLS. There are 6 unary operators: +, -, ++, --, ~, !. Those first two: + and - are not increment operators -- they are positive / negative -- used to change the sign of the number its in front of. ++ and -- are the increment operators we all know and love. Not having seen the question -- I'd say you're right in doubting what you saw. Mock exams have known to be wrong, the real exam is tricky -- but it doesn't have any errors in it. Good luck tomorrow! Get a good night's sleep!