当前位置: 代码迷 >> Java相关 >> 大家帮我看看这段程序
  详细解决方案

大家帮我看看这段程序

热度:123   发布时间:2010-08-14 19:44:57.0
大家帮我看看这段程序
public class tempreture
public static void main (String []args)
{double huashi=80;
    double sheshi=5/9.0*(huashi-32);
    System.out.println(huashi=80,
            sheshi);
}
}




Type mismatch: cannot convert from double to long
    The method println(long) in the type PrintStream is not applicable for the arguments (long, long)

    at tempreture.main(tempreture.java:4)
这是什么错误呀?
----------------解决方案--------------------------------------------------------
这段代码编译通过了?
System.out.println用于在控制台打印字符串
你的这句代码
System.out.println(huashi=80,
            sheshi);
应该没有通过编译,System.out.println只接收一个参数,并且当参数不为String类型时自动调用toString()方法
----------------解决方案--------------------------------------------------------
你少了个“{”,且system.out.pringln()只能接受一个参数,代码如下:
public class tempreture
{public static void main (String []args)
{double huashi=80;
    double sheshi=5/9.0*(huashi-32);
    System.out.println(huashi=80);
    System.out.println(sheshi);
}
}

----------------解决方案--------------------------------------------------------
谢谢大家哦!三楼的程序可以通过!
----------------解决方案--------------------------------------------------------
慢慢来吧,下载看了一个暑假的Java我可以发现你问题的原因了,仔细点,在学高级技术之前还是要夯实基础,尽量写代码风格化,注意要利用tab键
----------------解决方案--------------------------------------------------------
  相关解决方案