Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How to convert string type into int type in java
How to convert string type into int type in java
According to the example, there are two methods:

String? -& gt; ? Internationalorganizations (same as international organizations)

s = " 12345 ";

int? Me;

The first method: I = integer.parseint (s);

The second method: i=Integer.valueOf(s). int value(); The first method: I = integer.parseint (s); //Using the static method directly will not generate redundant objects, but will throw an exception.

The second method: i=Integer.valueOf(s). int value(); //Integer.valueOf(s) is equivalent to new Integer(Integer.parseInt(s)), and an exception will be thrown, but an extra object will be generated.