When comparing primitives of different numeric types, Java applies binary numeric promotion - the smaller type is automatically promoted (widened) to the larger type. For example, comparing int and long promotes the int to long. No explicit cast is needed.