다음 프로그램을 컴파일하고 추상 메소드 오류를 계속 받으려고합니다. 컴파일하려고하는 프로그램은 다음과 같습니다 (아직 완료되지 않았습니다). 다음과 같이 내가 받고있어 오류 : 그것은 당신이 ListInterface
에 getNext()
메서드를 재정의되지 않으며, 현재 두 getNext()
방법을 말한다Double은 추상 클래스가 아니며 ListInterface에서 추상 메서드 getNext()를 재정의하지 않습니까?
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){
}
}
오버라이드 된 모든 메소드에 @Override를 추가하십시오. 이해하는데 도움이됩니다 – BobTheBuilder
ListInterface.java 코드를 사용할 수 있습니까? –
@baraky을 사용하여 "getNext"를 찾으십시오. –
Vitaly