11. Generalizations

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

I’m having trouble on this
<Below this line, add a link to the EXACT exercise that you are stuck at.>

<In what way does your code behave incorrectly? Include ALL error messages.>

boolean tricky = true/false

image

either one I get it wrong
Please moderator help!

@artisarthur,
The thing you would be looking for is
the so-called precedence-Table

Found with a google search
== the Book ==
precedence table site:oracle.com
( oracle is the owner of Java )
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html

== discussions / opinions ==
java precedence table site:stackoverflow.com
for instance
http://stackoverflow.com/questions/2137690/java-operator-precedence-guidelines
http://stackoverflow.com/questions/14058617/java-operators-precedence

###============================================================

The precedence Table compressed to what we need

Operator Precedence

unary  !          most-important-should-be-processed-first
relational  >=  
logical AND && 
logical OR ||     less-important-should-be-processed-last

If parentheses-( ) are used
the part between the parentheses-( )
have to be processed with highest priority

( ( 3 >= 3 && !(true || true ) ) )  outer parens no-expression-processed
  ( 3 >= 3 && !(true || true ) )    outer parens no-expression-processed
    3 >= 3 && !(true || true )      process (true || true)
    3 >= 3 && ! true                process !true
    3 >= 3 && false                 process 3 >= 3
     true  && false                 process true && false
          false

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.