请问,数字可以直接作为字符串进行运算么?(str1+20) 等同于 str1+"20" 么?
public class HelloWorld {
public static void main(String[] args) {
double m = 78.5;
//将基本类型转换为字符串
String str1 =Double.toString(m);
System.out.println("m 转换为String型后与整数20的求和结果为: "+(str1+20));
}
}
public class HelloWorld {
public static void main(String[] args) {
double m = 78.5;
//将基本类型转换为字符串
String str1 =Double.toString(m);
System.out.println("m 转换为String型后与整数20的求和结果为: "+(str1+20));
}
}
2015-04-15
举报