1. Convert strings into plastic and floating point types
String s = "100"; //Method one int a = Integer.parseInt(String s); Long.parseLong(String s); Float.parseFloat(String s); Double.parseDouble(String s) //Method two int a = Integer.valueOf(s).intValue();
The difference: Integer.parseInt(String s) generates a plastic surgery;
Integer.valueOf(s).intValue() generates an object;
2. Convert plastic and floating point types into strings
int i=11; //Method one String s=i+""; //Method two String s=String.valueOf(i); //Method three String s=Integer.toString(i);
The above summary of the mutual conversion methods between Java strings, plastic shaping and floating point types is all the content I share with you. I hope you can give you a reference and I hope you can support Wulin.com more.