没有main方法,也就是说没有入口

解决方案 »

  1.   

    运行结果:In 1000 days light is travell 25920000000000kilometers.
    你的classpath有问题
                    '''             
                   (0 0)            
       +-----oOO----(_)------------+
       |                           |
       |         有感而发!         |
       |                           |
       |                           |
       +------------------oOO------+
                  |__|__|           
                   || ||            
                  ooO Ooo
      

  2.   

    It is class path problem. The class loader could not find Light.class. So, try:
    java -classpath <the path to the Light.class> Light
      

  3.   

    你的问题出在缺少一个关键字public,也就是
    public class Light {
             public static void main(String args[]) {
    int lightspeed;
    long days;
    long seconds;
    long distance;

    //光每秒的速度
    lightspeed = 300000;
    days = 1000; //以1000天计算
    seconds = days * 24 * 60 * 60;
    distance = lightspeed * seconds;
    System.out.print("In " + days);
    System.out.print(" days light is travell ");
    System.out.println(distance + "kilometers.");
    }
    }
    注意:以上的问题出在一般一个程序总要有一个public 类
    附:
    若你是初学者,我强烈推荐用jcreator pro 2.5版本,
    若你要搞大型软件,用jbuilder 8.0
      

  4.   

    考,在我机器上运行结果都出来了!(见上)
    代码没问题!
    你看看classpath吧
                    '''             
                   (0 0)            
       +-----oOO----(_)------------+
       |                           |
       |         有感而发!         |
       |                           |
       |                           |
       +------------------oOO------+
                  |__|__|           
                   || ||            
                  ooO Ooo
      

  5.   

    你不会是没考虑大小写吧?
                    '''             
                   (0 0)            
       +-----oOO----(_)------------+
       |                           |
       |         有感而发!         |
       |                           |
       |                           |
       +------------------oOO------+
                  |__|__|           
                   || ||            
                  ooO Ooo