Sunday, 20 February 2011

Operators questions in java



Questions on operators in java 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)



(2)

No comments:

Post a Comment