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 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.

The end result is that your 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.

You can write it like this in a lesser way:

  double d = (int) 0.1d;  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -