編程過程中報錯
IPlayGame ip3 = new IPlayGame(){
?? ??? ??? ?@Override
?? ??? ??? ?public void playGame() {
?? ??? ??? ??? ?// TODO Auto-generated method stub
?? ??? ??? ??? ?System.out.println("使用匿名內部類的方法實現接口");
?? ??? ??? ?}
?? ??? ??? ?
?? ??? ?};
?? ??? ?ip3.playGame();
*******************************
IPlayGame ip3 = new IPlayGame();
編輯時提示 The type new IPlayGame(){} must implement the inherited abstract method IPlayGame.playGame()
?? ? ?? 該類型的新iplaygame() {}必須實現繼承的抽象方法知識產權法律援助
//后來就沒有了
2015-10-17
樓主應該是在其他地方?IPlayGame ip3 = new IPlayGame(); 這個語句,因為之前的方法是在匿名類中實現的,匿名類相當于在 編譯時,自動增加了一個 Program1的類,實現IPlayGame接口,然后再將實例傳遞給ip3,當調用完畢了,這個Program1就不在了,所以,在其他地方 使用new接口時,就報錯了,錯誤是未實現方法