🎴 Flashcard Mode

Java Programming Fundamentals

Card1 / 20
Mastered0
Review0
QuestionClick to flip

What happens when you compare two primitives of different numerical types?

AnswerClick to flip back
A
smaller type is promoted
💡 Explanation:

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.

Change Mode