程序1implem不是抽象和在延伸的接口不覆蓋抽象方法FinalScore()
interface java{
public void setHomeTeam(String name);
public void setVisitingTeam(String name);
}
程序2
interface extension extends java {
public String HomeTeamScored();
public String VisitingTeamScored();
public String FinalScore();
}
程序3
public class implem implements extension{
private String Home;
private String Visit;
public String HomeTeamScored(){
return Home;
}
public String VisitingTeamScored(){
return Visit;
}
public void setHome(String Home){
this.Home = Home;
}
public void setVisit(String Visit){
this.Visit = Visit;
}
}
程序4
public class compilation{
public static void main(String [] args){
implem implement = new implem();
implement.setHome("Nihon");
implement.setVisit("Chuugoku");
System.out.println(""+implement.HomeTeamScored());
System.out.println(""+implement.VisitingTeamScored());
}
}
這些都是我的延長接口程序,而且我得到的錯誤:
implem is not abstract and does not override abstract method FinalScore() in extension public class implem implements extension{ ^ 1 error
Process completed.
有什麼不清楚的錯誤消息,你得到了什麼?實現'FinalScore()' – Eran
錯誤很明顯,你沒有在你的'實現類'中重載'FinalScore()'。所以重寫它,你的程序就可以工作。 –
請遵循java的命名約定 –