Question 25)
Which of the following statements are true?
1) The following statement will produce a result of 1. System.out.println( -1 >>>2);
2) Performing an unsigned left shift (<<<) on a negative number will always produce a negative number result <br /> 3) The following statement will produce a result of zero, System.out.println(1 >>1); <br /> 4) All the integer primitives in
java are signed numbers <br /> <br /> Answer to Question 25) <br /> Objective 5.1)<br /> 3) The following statement will produce a result of zero, System.out.println(1 >>1);
Although you might not know the exact result of the operation -1 >>> 2 a knowledge of the way the bits will be shifted will tell you that the result is not plus 1. (The result is more like 1073741823 ) There is no such Java operator as the unsigned left shift. Although it is normally used for storing characters rather than numbers the char Java primitive is actually an unsigned integer type.
now , should i include char in integral types? I remember studying that numeric types are divided into integral types and char -- integral are(byte,short,int,long)
------------------
Regards,
Shree