Skip to content
Anthony Christe edited this page Sep 5, 2013 · 2 revisions

Boolean Comparisons

Many expressions act on Boolean comparisons

  • if
  • for
  • while, do/while
  • switch
Boolean equality operators
Operator Description
== Equal to
!= Not equal to
> Greater than
>= Greater than or equal to
< Less than
<= Less than or equal to
Conditional Operators
Operator Description
&& Boolean AND
|| Boolean OR
?: Ternary

String Comparisons

  • ==
  • .equals
// Given
String a = "abc";
String b = "abc";
String c = b;

// What are the results of
a == b;
a.equals(b);
a == c;
b == c;

Clone this wiki locally