How to cast an Object to an int

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

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

19条回答
  •  感动是毒
    2020-11-27 10:19

    For Example Object variable; hastaId

    Object hastaId = session.getAttribute("hastaID");
    

    For Example Cast an Object to an int,hastaID

    int hastaID=Integer.parseInt(String.valueOf(hastaId));
    

提交回复
热议问题