• Post Reply Bookmark Topic Watch Topic
  • New Topic

How does the short-circuit && evaluate its operands?  RSS feed

 
Bora Sabrioglu
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you havethen why is the expression evaluated as though there were parantheses around ? Do the other operators like ||, |, &, etc. behave the same / similarly?
 
Paweł Baczyński
Bartender
Posts: 2087
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read this.
Operator | has higher precedencd than ||. The same is true for & and &&.
 
Bora Sabrioglu
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
aah... that explains everything. thanks!
 
Campbell Ritchie
Marshal
Posts: 56595
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you write logical expressions, the precedences ¬ ∧ ⊕ ∨ ⇒ ⇔ are different from Java's.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!