2017  Kodetalk | Feedback | Privacy Policy | Terms | About

How to convert numeric String to int or Integer using Java code

I have a string as below:

String num = "24";

what is the best way to convert this string to integer?


Try as below and you will get your expected result:

int i = Integer.parseInt(num);

Answer is