265 views
0 votes
0 votes

what is the difference between a bit wise operator and a short circuit operator? 

1 Answer

Best answer
5 votes
5 votes

Bitwise operator uses &

Ex- 1 & 3 = 0000 0001 & 00000011 = 0000 0001 

Short circuiting technique is used by logical operators by not evaluating the values of its arguments and hence sometimes called short circuit operators .

Ex- let i = 0,

Then , ( i && j) = 0 

This time only value of i is evaluated  which is 0 and answer is concluded without calculating value of j because whatever be the value, the answer will always be 0. 

So , in this way logical operators short circuit by not even considering what might j be, the final value of the complete expression will always be 0 .

selected by

Related questions

0 votes
0 votes
1 answer
1
LavTheRawkstar asked Jun 29, 2016
956 views
What is the output of the following code segment ?Boolean b= false ;if (b = true)System.out.println("true");elseSystem.out.println("false");(A) true(B) false(C) compiler ...
0 votes
0 votes
1 answer
3
LavTheRawkstar asked Jun 28, 2016
940 views
What is the difference between the following shift operators : A) >> operatorB) > operatorC) << operator
2 votes
2 votes
1 answer
4
LavTheRawkstar asked Jun 28, 2016
452 views
Why Java does not support multiple inheritance?i want answer in simple words. i have searched for this answer in every textbook.Everytext just says that it doesnot suppor...