点击提交显示是对的,但是为右侧的显示是报错??我写错了么??
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)); String str = "180.20"; // 将字符串转换为基本类型 Double a = Double.valueOf(str); System.out.println("str 转换为double型后与整数20的求和结果为: "+(a+20)); } }
点击提交显示是对的,但是为右侧的显示是报错??我写错了么??还是浏览器问题??
error: no suitable method found for toString(double)
String str1 = Integer.toString(m); ;
^
method Integer.toString() is not applicable
(actual and formal argument lists differ in length)
method Integer.toString(int) is not applicable
(actual argument double cannot be converted to int by method invocation conversion)
method Integer.toString(int,int) is not applicable
(actual and formal argument lists differ in length)
method Object.toString() is not applicable
(actual and formal argument lists differ in length)
error: cannot find symbol
Double a = Integer.valueof(str); ;
^
symbol: method valueof(String)
location: class Integer
2 errors