Hi Guys......
Check out the code below.
public class MyAr{
public static void main(
String argv[]){
long l = 99;
int i = 1;
int j = 0;
j=i<<l;>
System.out.println(j);
}
}
This ocde compiles cleanly and gives an output of 8. What I couldn't understand is how does it compile cleanly without giving an error???
In the statement j=i<<l; 'i' would first be promoted to long and the result of 'i><<l' which would be a long will be assigned to 'j' which is an int. Shouldn't the system give an error message as there is no explicit cast (from long to int) in the statement j=i<<l;>
Thanks in advance...
Shafeeq