- A long
- B int
- C double
- D float
- Share this MCQ
Answer:
C
Explanation:
In Java, when evaluating an expression that contains multiple data types, the type with the highest precision and range is chosen to represent the result of the entire expression. The promotion rules are applied as follows:
-
If the expression involves
double
,float
,long
, andint
, it is promoted to the type with the highest precision and range among these. -
The precedence of types from lowest to highest precision is:
int
long
float
double
Given the presence of double
, int
, float
, and long
in the expression, the highest precision and range type is double
.
Therefore, the whole expression will be promoted to:
c) double
Related Topic: