In Java, when comparing two different primitive numerical types (such as int and double), binary numeric promotion automatically promotes the operand with the smaller range or precision to match the larger/wider type before the comparison is executed, preventing compile errors.