Cast a Null String into Integer

前端 未结 7 940
闹比i
闹比i 2021-01-01 18:40

Is there any way to cast a null to Integer. The null is actually a String, which i am passing in my service layer that accepts it as an Integer. So, whenever i try to cast a

7条回答
  •  梦谈多话
    2021-01-01 18:57

    String s= "";  
    int i=0;
    i=Integer.parseInt(s+0);
    System.out.println(i);
    

    Try this

提交回复
热议问题