Sunday, February 20, 2011

Bitwise operators questions in java


Bit wise operators objective type questions and answers



(1)




public class BitwiseOpe {

public static void main(String[] args) {

int a=010;

Integer b=10;

double d=~a|(b=a)<<2+b;

System.out.print(d);

}

}



What will output when you compile and run the above code?



(a)32768.0

(b)-9.0

(c)1.0

(d)Compiler error













Answer: (b)


No comments:

Post a Comment