This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.

I have a question about shifting Question 70: To place a 1 in the high-bit of an int named ref that�s set to 0x00000001, you can write: Select the one right answer. A. ref >> 31; B. ref >>= 31; C. ref << 31; D. ref <<= 31; E. Shifts the bits in an integer to the left by the number of F. bits specified and fills the right-most bit with 1. F. Shifts the bits in an integer to the left by the number of bits specified and fills the right-most bit with 0. The answer as given in the test is d, but I thought the answer was c. I looked through the Robert Heller and Ernest book, and I cannot find a <<= shift operator anywhere. Thanks

if you use what proposed in c, then the result of the expression is lost since it is not reassigned. Since the question explicitely asks to "place a 1 in the high bit of an int named ref" you have to reassign the result to the variable ref and thus the only possible answer is d. the operator <<= is what is called a compound assignment operator and a <<= b is equivalent to a = a << b HIH ------------------ Valentin Crettaz Sun Certified Programmer for Java 2 Platform

Originally posted by Peter Chirco: I have a question about shifting Question 70: To place a 1 in the high-bit of an int named ref that�s set to 0x00000001, you can write: Select the one right answer. A. ref >> 31; B. ref >>= 31; C. ref << 31; D. ref <<= 31; E. Shifts the bits in an integer to the left by the number of F. bits specified and fills the right-most bit with 1. F. Shifts the bits in an integer to the left by the number of bits specified and fills the right-most bit with 0. The answer as given in the test is d, but I thought the answer was c. I looked through the Robert Heller and Ernest book, and I cannot find a <<= shift operator anywhere. Thanks

sadesh

Don't get me started about those stupid light bulbs.