M Bhalli

Greenhorn
+ Follow
since Oct 09, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by M Bhalli

I passed my certificaiton exam yesterday, Can i see my certificate online, or print it out,
Thank you cathy and Eric!!
Actually i couldn't understand the 1's complement process, Now i got it, Thanks a lot
~(bitwise inversion operator) it reverse all the bits of interger variable. What i m thinking that if int x=3;then 3 is being stored in x using 32 bits like 00000000000000000000011 (32bits), and when u apply ~x then 11 should convert to 00 and rest of all zeros should convert into 1's is it right, but when i compile the code the result is quite different. Please tell me what is going on here.
Thank you, M Bhalli
Thank you Jose,
i have one more question, That ~(bitwise inversion operator) it reverse all the bits of interger variable. What i m thinking that if int x=3;then 3 is being stored in x using 32 bits like 00000000000000000000011 (32bits), and when u apply ~x then 11 should convert to 00 and rest of all zeros should convert into 1's is it right, but when i compile the code the result is quite different. Please tell me what is going on here.
Thanks a lot!!
Thank You Pradeep,
but my question is, "do we have to convert these numbers to binary and then we can solve this kind of questions in exam or is there just a simple way of solving these kind of question because it takes a longer time to convert numbers into binary, Thanks
How can we approach this kind of question in java exam? we have to convert Hexadecimal numbers into binary and then try to find out the results or there is any other way we can quickly solve this kind of problem?
Thanks
class EBH019 {
public static void main (String args[]) {
int i1 = 0xffffffff, i2 = i1 << 1;
int i3 = i1 >> 1, i4 = i1 >>> 1;
System.out.print(Integer.toHexString(i2) + ",");
System.out.print(Integer.toHexString(i3) + ",");
System.out.print(Integer.toHexString(i4));
}}
What is the result of attempting to compile and run the program?
a. Prints: ffffffff,ffffffff,ffffffff
b. Prints: ffffffff,ffffffff,7fffffff
c. Prints: ffffffff,7fffffff,ffffffff
d. Prints: ffffffff,7ffffffe,7ffffffe
e. Prints: fffffffe,ffffffff,ffffffff
f. Prints: fffffffe,ffffffff,7fffffff
g. Prints: fffffffe,7fffffff,ffffffff
h. Prints: fffffffe,7fffffff,7fffffff
i. Run-time error
j. Compile-time error
k. None of the above
what will be the output of this program, and why there is no error of forward referencing in this case?
public class AQuestion
{
private int i = giveMeJ();
private int j = 10;
private int giveMeJ()
{
return j;
}
public static void main(String args[])
{
System.out.println((new AQuestion()).i);
}
}
Thanks!!