What will be the output of the program?

class Bitwise
{
public static void main(String [] args)
{
int x = 11 & 9;
int y = x ^ 3;
System.out.println( y | 12 );
}
}

Options
- 2
- 8
- 10
- 14


CORRECT ANSWER : 14

Discussion Board
Java

X=11&9;
Means 1011&1001=1001
y=x^3;
1001^0011=1110
It means 14 is correct.

M. Fakaruddin 02-18-2015 06:22 AM

Java

X=11&9;
Means 1011&1001=1001
y=x^3;
1001^0011=1110
It means 14 is correct.

M. Fakaruddin 02-18-2015 06:21 AM

this question able to answer by last operation and options

because 12 = 1100
so (y or 12) is will be the result = 11xx
so the options have only one possible value is 14 = 1110

ekk 10-20-2014 12:28 AM

explaination

can u explain this.

baalu 12-23-2013 12:47 AM

not able to understand

iam not able to understand how the output is generated

rajeev 12-12-2013 12:21 AM

Write your comments

 
   
 
 

Enter the code shown above:
 
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement