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
Try below code:application will return 0 if the string is null else it will parse the string to int if string contains a number alone..
code:application
0
int
Code:
(str.equals("null")?0:Integer.parseInt(str))