As far as I understand, byte, short, char, int, long, float, double, boolean and other types of data need to be directly compared with ==.
If it is a string, generally use equals to compare, because if the attribute in the object is a string, then == is wrong, because it will compare the memory address.