So I'm trying to do a really simple interface and super class, and I'm getting an issue with my @Override
statements saying annotation type not applicable to this kind of declaration
. Now I saw this StackOverflow questions that said it was a simple spelling error, but I checked my interface and my class and the function signatures are the same. Here is the interface:
package cit260.harrypotter.view;
public interface ViewInterface {
public void display();
public String[]getInputs();
public String getInput(String promptMessage);
public boolean doAction(String[] inputs);
}
and here is the super class:
package cit260.harrypotter.view;
import java.util.Scanner;
public abstract class View implements ViewInterface {
public View() {
@Override
public void display(){
boolean endView = false;
do {
String[] inputs = this.getInputs();
endView = doAction(inputs);
} while (!endView);
}
@Override
public String getInput(String promptMessage) {
String input;
boolean valid = false;
while(!valid) {
System.out.println(promptMessage);
Scanner keyboard = new Scanner(System.in);
input = keyboard.nextLine(); input.trim();
if (input.length != 0){
System.out.println("Please enter a valid input");
valid = true;
}
}
return input;
}
}
}
What am I doing wrong??