11. Generalizations


#1



I'm having trouble on this


boolean tricky = true/false



either one I get it wrong
Please moderator help!


#2

@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

#3

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