Tuesday 5 August 2014

Difference Between Bitwise operator and Short-circuit operator

Bit-wise operator :-


  •  In Bit wise operator both argument   
     are evaluated. 

  •  It work with both integral ans Boolean.                                 

  •  Relatively performance is slow.


Short-circuit operator :-


  • In Short-circuit operator 2nd  argument  evaluation is optional

  • It work with only Boolean type only.   

  • Relatively performance is fast


note:

&-operator ---> if both argument are true then only result is true otherwise false
 

|  -operator   ---> if at least one argument is false then result is false otherwise true

In Short-circuit operator

T && T  --

In this case the 1st argument is true then only 2nd argument is evaluated
           if 1st argument is false then 2nd argument is not evaluated.

No comments:

Post a Comment