Couldn't see the message Thomas f'ded, so I send this one again:
Hello,
in my little programm:
public class Shift1 {
public static void main (String [] args) {
int thirteen = 13;
int twentysix;
twentysix = thirteen << 1;
System.out.println ( thirteen + " is now " + twentysix);
}
}
I expect 13 (1101) to be shifted by one position to the left, i.e.
becoming 11010. I expected Java to fill the righthand of the bit
sequence with a 0. Since Java uses 32 bit, the result should be just
shifted one left and a zero added, resulting in decimal 26 (thanks
Thomas). But if you compile the above, you get 6.
What is wrong?
Bye
Pasquale

Signature
=======
"I'd like to buy Windows." "Are you mad?" "Why, is this part of the
license agreement"?
=======
VisionSet - 06 May 2004 12:45 GMT
> Couldn't see the message Thomas f'ded, so I send this one again:
>
[quoted text clipped - 19 lines]
> shifted one left and a zero added, resulting in decimal 26 (thanks
> Thomas). But if you compile the above, you get 6.
Well I get 26.
--
Mike W
> What is wrong?
>
> Bye
> Pasquale
Ryan Stewart - 06 May 2004 12:46 GMT
> Couldn't see the message Thomas f'ded, so I send this one again:
>
[quoted text clipped - 29 lines]
> license agreement"?
> =======
I get 26, as expected.
Pasquale Imbemba - 06 May 2004 13:32 GMT
> What is wrong?
If you start mixing up with files and names, that's the error.= 8-0
Thanks to both VisionSet and Ryan Stewart!
Pasquale