java.math.BigInteger cannot be cast to java.lang.Integer

后端 未结 5 1857
予麋鹿
予麋鹿 2020-12-13 09:48

I\'m getting the following exception.

Caused by:

java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Integer

5条回答
  •  长情又很酷
    2020-12-13 10:40

    java.lang.Integer is not a super class of BigInteger. Both BigInteger and Integer do inherit from java.lang.Number, so you could cast to a java.lang.Number.

    See the java docs http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Number.html

提交回复
热议问题