3. Using Operators and Decision Constructs

Note:

  • there is overlap between topics, which is unavoidable due to the organisation of the objectives
  • Touched on topics are introduced, but covered in other sections in much greater detail


Use Java operators; including parentheses to override operator precedence


Topics:

  • operators, operands and expressions
  • arithmetic operators and operator predecence
  • String concatenation using +
  • Promoting operands
  • increment and decrement
  • Shift operators
  • Comparison operators
  • Logical operators, including short-circuited
  • Assignment operators
  • Other operators



Test equality between Strings and other objects using == and equals ()


Topics:

  • String literals vs String objects
  • Which objects implement equals(), and those that only provide reference equality



Create if and if/else and ternary constructs


Topics:

  • if/else if/else if/else
  • ternary operator



Use a switch statement


Topics:

  • Supported data types and values
  • case, break and default
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License