I was trying to write the following piece of code, but the error happened on line return super.getAge("Jack");
It showed "The method getAge() is undefined for the type Object". I guess the "super" keyword is not identified here.
Does anyone have any suggestions that how to fix this error? Thanks so much!
public class Parent {
public int getAge(String name) {
System.out.println("Get the age of the parent.");
return 40;
}
}
public class Child extends Parent {
@Override
public int getAge(String name) {
Future<Integer> ageFuture = null;
@Qualifier("XXX")
private ExecutorService executorService;
try {
ageFuture = executorService.submit(new Callable<Integer>() {
public int call() throws Exception {
return super.getAge("Jack");
}
});
} catch (Exception e) {
logger.error(" ", e);
}
return 10;
}
}