About Question enthuware.ocajp.i.v7.2.972 :
Posted: Sat Mar 02, 2013 9:17 am
Ok, I agree here.
Besides the scope of the question..
short s = 10;
it compiles ok..
10 is implicitly an int.
How does the compile do in order to accomplish the operation without causing an exception?
There is an implicit conversion like (short)10. or the compiler sees at compilation time that the number 10 can actually fit a short and therefore no problem?
What happens behind the scenes?
Thanks a lot in advance.
Besides the scope of the question..
short s = 10;
it compiles ok..
10 is implicitly an int.
How does the compile do in order to accomplish the operation without causing an exception?
There is an implicit conversion like (short)10. or the compiler sees at compilation time that the number 10 can actually fit a short and therefore no problem?
What happens behind the scenes?
Thanks a lot in advance.