Relational and Equality operators

Relational operators are used to evaluate a test case before entering a protected block of code

  • less than <
  • greater than >
  • less than or equal to<=
  • greater than or equal to>= 
  • instanceof 
  • equal to == 
  • not equal to !=


These operators are used to verify a set of tests either

  • Collectively using the Conditional-And, implying that if one test fails, the whole evaluation fails. (in code we write &&)
  • Or individually with the Conditional-or, implying that only one test evaluated to True is needed, the other tests aren't passed by. (in code we write ||)

Ternary operators

Ternary operators are used to compact conditional blocks of code into one line. These conditional blocks must treat only two cases, for instance, this example 

  • if(test){First case;}else{Second case;}   

becomes :

  • Test First case : Second case 

If the Test evaluates to true, the first case block is entered, otherwise, the second.