从覆盖方法访问另一个方法中的类

时间:2015-04-07 02:08:17

标签: java

我有一个类CircularListLinkedListReferenceBased ...我的大部分方法都基于LinkedListReference。我已经覆盖了圆形列表中的方法删除....在我的方法中,我有一个名为find()的方法,它位于LinkedListReferenceBased ...当我在CirclarList中使用方法时删除从重写方法删除我得到这个错误?

cannot find symbol
    Node prev = find(index-1);
                ^
  symbol:   method find(int)
  location: class CircularList

1错误

CIRCULARLIST

public void remove(int index){
super.remove(index);

System.out.println("-------");
int num = index;
while(size>0){

    //System.out.println("strt");
    if(index>= 0 /*&& index < size*/){
      if(index == 0) {
      //delete the first node from the list
      System.out.println("REMOVED :"+head.item());//----------------EXR
      head = head.getNext();
    }
    else {
        Node prev = find(index-1);

        // delete the node after the node that prev
        //references, save regerence to node
        Node curr = prev.getNext();

        System.out.println(curr.item());
            if(size > 1){

        }
        else{
            System.out.print("is the last one left");
        }
        prev.setNext(curr.getNext());
        curr = prev.getNext();

        index+=num-1;

        }//end if
           size--;
    //System.out.println(size+" <-size || index-> " +index);

          }//end if

    }

}//end remove

为什么我收到此错误?

0 个答案:

没有答案