How to cast an Object to an int

后端 未结 19 1957
长情又很酷
长情又很酷 2020-11-27 09:58

How can I cast an Object to an int in java?

19条回答
  •  南方客
    南方客 (楼主)
    2020-11-27 10:28

    You have to cast it to an Integer (int's wrapper class). You can then use Integer's intValue() method to obtain the inner int.

提交回复
热议问题