Hi All,
I have the following example can some guru explain me why am i getting this answer.
public class Myclass
{
public static void main (
String [ ] args )
{
test ( 1 << 32, "1 << 32" );
test ( 1 << 31, "1 << 31" );
test ( 1 << 30, "1 << 30" );
test ( 1, "1" );
test ( 0, "0" );
test ( -1, "-1" );
}
public static void test ( int i, String exp )
{
if (( i >> 1 ) != ( i >>> 1 ))
System.out.println ( exp );
}
}
select all valid answers.
a) "1<<32" b) "1<<31" C) "1<<30" d) "1" e) "0" f) "-1"
the answer is b & f.
i would really appreciate if someone can explain this.
Thanks in advance
Ketu