Assume we have int x = 4
and I want to assign x
as a digit after the decimal in the following double number:
double value = 2.x;
so the value
should be 2.4
How can I do that in Java?
一个简单的方程式应该有所帮助
double value = 2 + x / 10.0;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.