Hello everybody,
I am a newcomer, I am preparing for
SCJP, I have bought Kathy's book and I am doing some exercises other than that i found in the book...
this evening I found the following question on
http://www.javaprepare.com/quests/operat_q.html question number 11
What gets printed when the following program is compiled and run. Select the one correct answer.
well, the possible answers are
and the right answer is H ??? why
here is the process I do in my mind, please tell me where is my fault!
1. a byte is 8 bit
2. a byte with value 3 has this bit rapresentation 00000011
3. now the complement operator ~ inverts all the bits, so that each 1 bit becomes 0, and each 0 bit becomes 1. If this is right I should obtain:
11111100 which is 252... am i right? or I missing something?
P.S.: please forgive my bad english...
java is not the only language I have to learn
Ciao, Gabriele