The == operator means equals, while the != operator means not equals. They are used to compare values of the same type and return the boolean value true if the operand's values are equal or false otherwise. Observe the following, for example:
int i1 = 1;
int i2 = 2;
System.out.println(i1 == i2); //prints: false
System.out.println(i1 != i2); //prints: true
System.out.println(i1 == (i2 - 1)); //prints: true
System.out.println(i1 != (i2 - 1)); //prints: false
Exercise caution, though, while comparing values of floating-point types, especially when you compare the results of calculations. Using relational operators (<, >, <=, and >=) in such cases is much more reliable because the division 1/3, for example, results in a never-ending fractional part 0.33333333... and ultimately depends on the precision implementation (a complex topic that is beyond the scope of this book).