Hi Meaning of line2 is, caste i into byte - apply shift operator - print the result in binaryformat line 1 + line3 does the same thing . output of first two s.o.p() statements is same, then why line4 & line5 are displaying different values? can any one of u explain me the reason? Thanx in advance [ December 28, 2005: Message edited by: Naresh Kumar ]
posted 10 years ago
Hi i hv got the solution.
System.out.println(b>>a);//line5 - here b is upcasted to int. i=128 (decimal) = 10000000 (Binary) b=(byte)i= 11111111111111111111111110000000 ( upcasting - all the leftside bits are filled with sign bit '1')