Given this code fragment:
What is the resulting value?
Math.round rounds the approximately 33.333 double value to 33. The character 'a' has integer value 97, which is not equal to hexadecimal 0xA (10), so the conditional divisor is 3. Because 10f makes the divisions floating-point operations, the computed float value is approximately 1.1.
Math.round
'a'
0xA
10f
1.1
Community Discussion