Java对象不是抽象的,并且未覆盖类中的抽象方法,怎么回事? 20
publicinterfacePetWatcher{publicStringfeedPet();publicStringplaysWithPet();}abstractc...
public interface PetWatcher { public String feedPet(); public String playsWithPet();}abstract class Person { private String name;}class Worker extends Person implements PetWatcher { private String name; Worker(String name) { this.name = name; } public String feedPet() { return "meat"; } public String playWithPet() { return "ball"; }}class Farmer extends Person implements PetWatcher { private String name; Farmer(String name) { this.name = name; } public String feedPet() { return "rice"; } public String playWithPet() { return "run with it"; }}class Cadre extends Person implements PetWatcher { private String name; Cadre(String name) { this.name = name; } public String feedPet() { return "cans"; } public String playWithPet() { return "let it swim"; }}
展开
1个回答
展开全部
hello你已声明为要实现KeyListener和ActionListener接口。那么你这必须要实现KeyListener接口的keyPressed、keyReleased、keyTyped方法和ActionListener接口的actionPerformed方法。而在你的hello类的实现中,仅完成了keyRelease方法,没有达到KeyListener和ActionListener接口的要求。就会出现这个提示。
追问
我靠,你不要这样直接把别人的答案复制过来吧
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询