public class test {
int[] acount(int m, int n){
   int x,y,z;
   int i = 0;
   int result[] = new int[9];
     for (x = 0; x < 9; x++)
   {for (y = 0 ; y < 9 ;y++){
        for (z = 0; z < 9; z++){
          if (x + y == m){
            if (y + z == n){
                result[i] = x;
                i ++;
              }
              }            }
          }
          }
return result;
   }
   
   public static void main(int[] args){
    int output[];
    test test1 = new test();
   
    output = test1.acount(args[0],args[1]);
    for (int a = 0; a < output.length; a++){
    System.out.println(output[a]); 
    }
   
   
   
}
}执行的时候报Exception in thread "main" java.lang.NoSuchMethodError: main

解决方案 »

  1.   

    这种问题很有可能是classpath的问题,在前面加.;试试看
      

  2.   

    不是classpath的问题,在前面已经加了.; 。其实的程序也可以执行的。
      

  3.   

    发现你的main函数的参数错了,应该是String args[],其他参数程序当一般函数,而不是程序的入口了
      

  4.   

    public static void main(int[] args)  ???
    public static void main(String[] args)  才对阿
      

  5.   

    public static void main(int[] args)定义不对
    应该这样定义
     public static void main(String[] args) 
    或着 
     public static void main(String args[])
      

  6.   

    入口方法main的参数必须是String类型的数组
      

  7.   

    public static void main(int[] args)改成 public static void main(String[] args)
    然后 
    output = test1.acount(args[0],args[1]); 改成
    output = test1.acount(Integer.parseInt(args[0]), Integer.parseInt(args[1]));
      

  8.   

    把String类型参数转换成int类型怎么转换