Given:
What is the result?
A.
int sum is 30
float sum is 30.0
B.
int sum is 30
double sum is 30.0
C.
integer sum is 30
double sum is 30.0
D.
integer sum is 30
float sum is 30.0
Given:
What is the result?
A.
int sum is 30
float sum is 30.0
B.
int sum is 30
double sum is 30.0
C.
integer sum is 30
double sum is 30.0
D.
integer sum is 30
float sum is 30.0
B
B.
int sum because 10 and 20 are primitive values. Integer.valueOf(10) would return Integer sum.
double sum because 10.0 and 20.0 aren’t float because doesn’t have the literal f. then jvm uses or promotes to double values.
B