I'm rather new to Java, BlueJ, and all that. I'm trying to figure out the data type of this expression, which I'm thinking is int. But I'm not too sure, and I'd love help! The expression is listed below.
(3 + 4 / (int)3.14) * 5
It's int
. This can be easily proven by using JDK9+'s jshell:
jshell> (3 + 4 / (int)3.14) * 5
$1 ==> 20
jshell> /vars
| int $1 = 20
As you can see, the inferred type of the expression is int
.