Computer Science, asked by arizazmi2000, 7 months ago

16. Java expression 13/3
gives the output:

Answers

Answered by rkpr587
1

Explanation:

SoloLearn

Learn to Code for Free

GET IT NOW

+1

Give the output of the following. int x=13^3&8; System.out.println(x); Please show the process.

java

24th February 2017, 11:54 PM

Arghyadeep Ghosh

2 Answers NEW ANSWER

Sort by:

+3

Bitwise operations.

13 = 1101

3 = 0011

8 = 1000

bitwise and & has higher precedence so it is done 1st

3 & 8

0011

1000

--------

0000 = 0

next bitwise xor ^

13 ^ 0

1101

0000

--------

1101 = 13

25th February 2017, 12:36 AM

ChaoticDawg

+1

The expression 13^3&8 is 13 'XOR'ed with 3 bit 'AND'ed with 8.

But bit 'AND' has higher precedence than 'XOR', so that is processed 1st:

3&8 has result 0.

Then 13^0 has result 13.

Final result is 13.

Similar questions