String userid = "user001";
int int_userid = Integer.parseInt(userid) != null ? Integer.parseInt(userid) : 0);
Did you mean this syntax?
But since an int
can never be null
you have to instead do:
String userid = "user001";
int int_userid;
try {
int_userid= Integer.parseInt(userid);
} catch (NumberFormatexception e) {
int_userid = 0;
}