java - Converting a variable from Double to Int -
Let's say I have variable tmp which is double, and I want to convert the TMP to an integer, But still how would I do this variable named Tmp? Thank you
You do not have the same variables as both int
Can be a double
.
You may have it though:
double D = 0.1d; Int i = (int) d; D = (double); Println (d);
In fact, for the first time you enter your The end result is that your You can write it like this in a lesser way: double
in a integer
, then lose the numerator. Afterwards, you place it on double
and specify it in your d
variable. You do not have to explicitly cast int
to double because it is a comprehensive conversion, but it makes it clear what happens.
d
variable is now a value that can be interpreted properly by an integer, but on the other hand, well, basically Your variable threw your variable no to change its type, though.
double d = (int) 0.1d;
Comments
Post a Comment