Given the following variables which of the following lines will compile without error? String s = "Hello"; long l = 99; double d = 1.11; int i = 1; int j = 0;
1) j= i <<s;> 2) j= i<<j;> 3) j=i<<d;> 4)j=i<<l;>
Answer :2,4 can anybody explain how ans 4 is correct thanx sherinn
I think sheri is right i<<l should become long and cannot be assigned to an int without an explicit cast.> This is from a mock exam which i noted because I also felt it was a mistake.(Marcus Green II).