Topic: 请问关于java.lang.math的问题

  Print this page

1.请问关于java.lang.math的问题 Copy to clipboard
Posted by: siage
Posted on: 2004-09-15 15:46

为什么我在j2sdk1.4.2_04下无法调用math类,而在j2sdk1.4却可以?我在2台不同的机器上编译同一个程序,在装有j2sdk1.4.2_04下就会出现如下错误:
mathtest.java:6: cannot resolve symbol
symbol : method sqrt (double)
location: interface Math
System.out.println("the sqrt(7.0)= "+Math.sqrt(7.0));
附上mathtest.java
import java.lang.Math.*;
public class mathtest
{
public static void main(String args[])
{
System.out.println("the sqrt(7.0)= "+Math.sqrt(7.0));
}
}
j2sdk1.4.2_04环境变量配置:
path=C:\j2sdk1.4.2_04\bin
class_path=c:\j2sdk1.4.2_04\lib\tools.jar;
c:\tomcat\common\lib\servlet.jar;
D:\mysql\lib\WEB-INF\lib\mm.mysql-2.0.4-bin
^

2.Re:请问关于java.lang.math的问题 [Re: siage] Copy to clipboard
Posted by: nothing
Posted on: 2004-09-15 16:19

classpath , 不是 class_path

但是我的 classpath=.

就可以,你的。。。怪.

3.Re:请问关于java.lang.math的问题 [Re: siage] Copy to clipboard
Posted by: siage
Posted on: 2004-09-15 18:32

我也很奇怪啊,我把.java文件放在别的文件夹里编译就可以,但是就是在原来的文件夹里不行,只要是Math类就都会出现这种问题,真是怪了,是我设置的不对吗?但是调用别的类都没有问题,只有Math类,只要调用就会出问题

4.Re:请问关于java.lang.math的问题 [Re: siage] Copy to clipboard
Posted by: helloworld
Posted on: 2004-09-15 21:54

极有可能是RPWT. Smile

5.Re:请问关于java.lang.math的问题 [Re: helloworld] Copy to clipboard
Posted by: why
Posted on: 2004-09-15 22:10

helloworld wrote:
极有可能是RPWT. Smile

What's RPWT?Shy

6.Re:请问关于java.lang.math的问题 [Re: why] Copy to clipboard
Posted by: hncszy
Posted on: 2004-09-16 00:40

why wrote:
What's RPWT?Shy


rpwt
abbr.
=人品问题,bbs、论坛中常用语。Question

7.Re:请问关于java.lang.math的问题 [Re: siage] Copy to clipboard
Posted by: siage
Posted on: 2004-09-16 11:27

不至于吧,本人一向忠厚老实,待人热情,为人诚恳(此处省去n w句)。。。
怎么不是jdk发彪呢?

8.Re:请问关于java.lang.math的问题 [Re: siage] Copy to clipboard
Posted by: dorrenchen
Posted on: 2004-09-16 21:23

remove the line "import java.lang.Math.*" and try again.

All classes in java.lang package are included by default, no need to import in your code.

and java.lang.Math is a class, not a package.

class name should always starts with a capital letter, like "Mathtest"


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923