Convert String to int in Java
Description
The following code shows how to convert String to int.
Example
// ww w .jav a 2s . com
public class Main {
public static void main(String[] args) {
String str = new String("10");
int i = Integer.parseInt(str);
System.out.println(i);
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »