Any way to cast java.lang.Double
to java.lang.Integer
?
It throws an exception
"java.lang.ClassCastException: java.lang.Double incompatible with java.lang.Integer"
castingjava
Any way to cast java.lang.Double
to java.lang.Integer
?
It throws an exception
"java.lang.ClassCastException: java.lang.Double incompatible with java.lang.Integer"
Best Answer
You need to explicitly get the int value using method intValue() like this:
Or