I want to know what happened when Double
invert to int on my example?
this case is right
Double d = 123.13;
int i = (int)(Math.random()*d);
this case is wrong
Double d = 123.13;
int i = (int)(d);
error message:
Inconvertible types;cannot cast'java.lang.Double'to'int'
and I know I can use d.intValue
to do this, but I just want to know what is the difference about the two situations above