Any way to cast java.lang.Double to java.lang.Integer?
java.lang.Double
java.lang.Integer
It throws an exception
"java.lang.ClassCastException: java.lang.Double incompatible with java.lang.Integer"
You need to explicitly get the int value using method intValue() like this:
Double d = 5.25; Integer i = d.intValue(); // i becomes 5
Or
double d = 5.25; int i = (int) d;
1.4m articles
1.4m replys
5 comments
57.0k users