ack23类继承的时候报can not resolve symbol,symbol ACK...高手指教
代码如下
ACK.JAVA文件
public class ACK
{
int ack(int m,int n)
{
   int k;
   if (m==0)
      k=ack(m-1,1);
   else
      k=ack(m-1,ack(m,n-1));  
   return k;

ack23.java文件
public class ack23 extends ACK
{
public static void main(String args[])
{
int n=ACK.ack(2,3);
System.out.println(n);
}
}}两个文件在同一文件夹下,且classpath也设置到类文件所在文件夹,ACK文件也编译成功,
请教是为什么出现这个问题?

解决方案 »

  1.   

    你的这个方法int   ack(int   m,int   n) 应该声明为静态的public static int   ack(int   m,int   n) 
      

  2.   

    it really depends on what u want.u can solve this problem by either re-declaring the ack as static method or defining a new instance of ACK class and then invoking the member method ack.If you pick the first, then it's no sense to make class ack23 inherit from ACK at all. 
      

  3.   

    public   static   void   main(String   args[]) 

    int   n=new ACK().ack(2,3); 
    System.out.println(n); 

      

  4.   

    非静态方法不能直接通过类来调用
    加上static就行了