没听说有什么不同,是不是你1.4的classpath没有正确设置?

解决方案 »

  1.   

    我是2000操作系统,在环境变量里面“CLASSPATH”我是这样配置的,c:\j2sdk1.4\lib\dt.jar;c:\j2sdk1.4\lib\tool.jar;c:\j2sdk1.4\bin
    难道不对阿??
      

  2.   

    还是classpath的问题。和版本无关。
      

  3.   

    JDK1.3和jdk1.4没有太大的区别,只是1.4比1.3多增加了一些高级功能,你的问题是因为Classpath设置有问题;另外,注意import和package的使用方法就可以了
      

  4.   

    那我设置classpath有什么问题啊?能不能帮我写一下啊??
    其实我就是编译wrox出的一本Beginning java2(jdk1.3)书上的代码.我把它贴出来.
    他们分别是两个类!!每个类是一个独立的java文件!! 要编译的是有main方法的CreateSpheres类!!而Sphere类是CreateSpheres调用的!!! (javac CreateSpheres.java)public class CreateSpheres
    {
    public static void main(String[] args)
    {
    System.out.println("Number of objects =" + Sphere.getCount()); Sphere ball=new Sphere(4.0,0.0,0.0,0.0);
    System.out.println("Number of objects ="+ ball.getCount());

    Sphere globe=new Sphere(12.0,1.0,1.0,1.0);
    System.out.println("Number of objects =" + globe.getCount()); //Output the volume of each sphere
    System.out.println("ball volume=" + ball.volume());
    System.out.println("globe volume =" + globe.volume());
    }
    }@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    public class Sphere{
    static final double PI=3.14;
    static int count=0; double radius;
    double xCenter;
    double yCenter;
    double zCenter;
    //Class constructor
    Sphere(double theRadius,double x,double y,double z)
    {
    radius=theRadius;  //Set the radius //Set the coordinates of the center
    xCenter =x;
    yCenter=y;
    zCenter=z;
    ++count;
    } //Static method to report the number of objects created
    static int getCount()
    {
    return count;
    } //Instance method to calculate volume
    double volume()
    {
    return 4.0/3.0*PI*radius*radius*radius;
    }}
      

  5.   

    在编译时只要键入javac CreateSpheres.java就能将两个java文件一起编译的啊.编译器会自动识别Sphere.java文件的啊!!!难道这样不对吗????jdk1.4在环境变量里面怎么设置的???与jdk1.3不一样吗???