“==” or equality operator in Java is a binary operator provided by Java programming language and used to compare primitives and objects . In terms of comparing primitives like boolean, int, float “==” works fine but when it comes to comparing objects it creates confusion with the equals method in Java.