日期:2014-05-20  浏览次数:20699 次

小程序,在dos中运行没问题,但是在myeclipse中运行出错,求解释
其实我是想用这个程序判断象限问题的
Java code

import java.util.*;
public class xiangxian 
{
    public static void main(String[] args)
    {
        float x,y;
        Scanner s1 = new Scanner(System.in);
        Scanner s2 = new Scanner(System.in);
        System.out.println("请输入X的值:");
                x = s1.nextFloat();
        System.out.println("请输入Y的值:");
        y = s2.nextFloat();
        if(x>0&&y>0)
        {
            System.out.println("第一象限");
        }
        if(x<0&&y>0)
        {
            System.out.println("第二象限");
        }
        if(x<0&&y<0)
        {
            System.out.print("第三象限");
        }
        if(x>0&&y<0)
        {
            System.out.println("第四象限");
        }
        if(x==0)
        {
            System.out.println("在Y轴上");
        }
        if(y==0)
        {
            System.out.println("在X轴上");
        }
    }
}


出错提示是:
java.lang.NoSuchMethodError: main
Exception in thread "main"

------解决方案--------------------
貌似程序本身没问题。
------解决方案--------------------
能运行啊,在MyEclipse上,LZ是不是构建的项目错了。
------解决方案--------------------
程序本身没有问题的,可能是myeclipse的问题吧,
------解决方案--------------------
有时候eclipse和myeclipse或者其他的软件都有莫名其妙的问题,只能换其他的试试了。