• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Explain &&,&,||,|

 
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good morning to all
Explain &&,&,||,|
Example with concepts
regards
rex
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

If there is a double operator it is a shortcircuit one.

for example say x && y where x and y are boolean.

Here if x is false. Then y is not evalueated as what ever by the value of y the out come is false. right?

if you write x & y even if x is false Y is evaluated and final value is decided.


If i am wrong somebody please correct me!

Regards Paddy
 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bitwise Operators
Bit wise binary operators & (AND), | (OR) and ^ (XOR) works on all integral data types.

Short circuit && (AND) and || (OR)
&& and || are also known as Conditional-And and Conditional-OR operations. These operators are introduced for optimization. They work only on boolean operands.
In case of &&,
(expr1) && (expr2) //expr2 is never evaluated if expr1 is false.
In case of ||,
(expr1) || (expr2) //expr2 is never evaluated if expr1 is true.
 
reply
    Bookmark Topic Watch Topic
  • New Topic