Forums Register Login

Marcus Q46

+Pie Number of slices to send: Send
Hi,
This is the question from marcus
Which of the following will compile without error?
String s = "Hello";
long l = 99;
double d = 1.11;
int i = 1;
int j = 0;
The answer is j = i << j and j = i << l
I understood the first answer j = i << j. But why is the answer j = i << l correct? I thought that b'coz of arithmetic promotion, i << l is promoted to long & how does it fit into j? Can anybody please help me with this?
Thanks
rubna
[This message has been edited by Jim Yingst (edited July 10, 2000).]
+Pie Number of slices to send: Send
rubna,
Your question was already discussed here
They worship nothing. They say it's because nothing is worth fighting for. Like this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 671 times.
Similar Threads
Bit shifting
Sorry for the misprint of my previous question
Just a simple Question on Conversion..
Primitive Casting
Shift & promotion
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 04:59:26.