Hi friends check out following code;
Why does the compiler gives an error at line 8 & not on line no.7?
What is difference between them?
But both gives same o/p for int.(i.e 127 & 31)
public class
Test {
public static void main(
String args[])
{
byte b = 127 ; //same for short.
System . out . println ( b) ;
b>>=2; //doesn't gives an error. line7.
// b=b>>2; //gives an error,'possible loss of precision'. line 8
System . out . println (b) ;
}
}
Bye.
Take care.
Shubha.