This week's book giveaways are in the iOS and Features new in Java 8 forums. We're giving away four copies each of Barcodes with iOS: Bringing together the digital and physical worlds and Core Java for the Impatient and have the authors on-line! See this thread and this one for details.
I took one of the many tests out there and got this question:
Which of the following lines of code, considered individually, compile(s) without error? Choose all correct options. A) int i=1; int j = &simi; B) int i=1; int j = !i; C) boolean b = true; boolean c = &simb; D) boolean b = true; boolean c = !b;
I had no idea the &sim operator existed, so I answered D. But apparently, this was the correct answer:
Correct selection is: A, D The &simoperator performs bitwise inversion on integral types; it may not be applied to boolean data. The ! operator inverts boolean values; it may not be applied to integral types.
Can anyone explain what the &sim operator is? Where can I find more information on it? Are there more operators like this one? -- Christoffer
Hi, Christoffer You answered correct - A is wrong answer! There is no sim operator in Java ! Try compile this code and you'll be sure in this. Where you found this test? This is not correct test. Jamal Hasanov www.j-think.com
Joined: May 22, 2002
Ah, it must have been the ~ operator. The makers must have forgot the ; when typing ∼