0

次のプログラムをコンパイルしようとしていますが、抽象メソッド エラーが発生し続けます。コンパイルしようとしているプログラムは次のとおりです (ただし、まだ完全ではありません)。私が受け取っているエラーは次のとおりです。

Double.java:5: error: Double is not abstract and does not override abstract method getNext() in ListInterface
public class Double<T extends Comparable<T>> implements ListInterface<T>{
       ^
  where T is a type-variable:
    T extends Comparable<T> declared in class Double
1 error

import java.io.*;
import ch06.lists.*;
import support.DLLNode;

public class Double<T extends Comparable<T>> implements ListInterface<T>{

    protected DLLNode<T> front;
    protected DLLNode<T> rear;
    protected DLLNode<T> curPosition;
    protected int numElements;

    public Double(){
        front = null;
        rear = null;
        curPosition = null;
        numElements = 0;
    }

    protected DLLNode<T> find(T target){

    }

    public int size(){
        return numElements;
    }

    public boolean contains(T element) throws NullPointerException{
        if (DLLNode.getInfo()!=element){
            return false;
        }
        else{
            return true;
        }
    }

    public boolean remove(T target) throws StackUnderflowException{
        if (!contains(target)){
            return false;
        }
        else{
            return true;
            DLLNode.setLink()==null;
        }
    }

    public T get(T element){
        return find(element);
    }

    public String toString(){

    }   

    public void reset(){

    }

    @Override
    public T getNext(){
        return null;
    }

    public void resetBack(){

    }

    public T getPrevious(){

    }

    public void add(T element){

    }
}
4

3 に答える 3

0

とった!

} がありません:

public boolean remove(T target) throws StackUnderflowException{
    if (DLLNode.contains()==target){
        return true;
        DLLNode.setLink()==null;
}

ここで何をしようとしているのかはよくわかりませんが...

の:

   public boolean remove(T target) throws StackUnderflowException{
        if (!contains(target)){
            return false;
        }
        else{
            return true;
            DLLNode.setLink()==null;
        }
    }

値を返してから別のコマンドを実行することはできません。戻る順番を入れ替え&DLLNode.setLink()==null;

于 2013-04-09T17:37:38.737 に答える
0

ここには多くのエラーがあります。

いくつか:

1.

 protected DLLNode<T> find(T target){

何かを返す必要があります。

2.

 public String toString(){

何かを返す必要があります。

3.

public T getPrevious(){

何かを返す必要があります。

4.

    protected DLLNode<T> find(T target) {

その間

    public T get(T element) {
        return find(element);
    }

get() が T を返し、find() が返すことを確認してください。DLLNode<T>


コンパイラはそのすべてに混乱し、少なくとも何かを修正するように言いました:)

于 2013-04-09T17:52:53.630 に答える