java中字符串和基本数据类型的装换
package Class;
import java.util.Locale;
public class BasicDataStructureTransfer {
public static void main(String[]args){
String strint="123";
int a=Integer.parseInt(strint);
int b=new Integer(strint);
System.out.println(a);
System.out.println(b);
String str2="123.45";
double p=Double.parseDouble(str2);
double p2=new Double(str2);
System.out.println(p);
System.out.println(p2);
int a2=1234;
String ss=String.valueOf(a2);
System.out.println(ss);
double s2=123.45;
String s22=String.valueOf(s2);
System.out.println(s22);
boolean s3=false;
String s33=String.valueOf(s3);
System.out.println(s33);
System.out.println(s33.toUpperCase());
}
}