The not-equal operator, != , is the opposite, evaluating to true if the values are different. Typically, you use == and != with primitives such as int and boolean, not with objects like String and Color.