库存是不是抽象的,不重写抽象方法 [英] Inventory is not abstract and does not override abstract method
问题描述
OK,所以我的小程序没有编译和我Google了一些答案,并没有奏效。 (如乘坐公共出来公共类的)...
OK so my applet is not compiling and I Googled some answers and none worked. (Such as taking public out of public class)...
下面是我的code: http://www.so.pastebin.com/MBjZGneg一>
Here's my code: http://www.so.pastebin.com/MBjZGneg
Heere是我的错误:
Heere is my error:
C:\\用户\\丹\\文档\\ DanJavaGen \\ Inventory.java:12:库存不是抽象的,不覆盖java.awt.event.KeyListener抽象方法的keyReleased(java.awt.event.KeyEvent中)
公共类库存扩展的Applet实现的KeyListener {
C:\Users\Dan\Documents\DanJavaGen\Inventory.java:12: Inventory is not abstract and does not override abstract method keyReleased(java.awt.event.KeyEvent) in java.awt.event.KeyListener public class Inventory extends Applet implements KeyListener {
...帮助? :)谢谢。
... help? :) please.
推荐答案
这意味着它说什么。你是不是贯彻<一个href=\"http://java.sun.com/javase/6/docs/api/java/awt/event/KeyListener.html#keyReleased%28java.awt.event.KeyEvent%29\"相对=nofollow>调用keyReleased 方法。你还没有实施<一个href=\"http://java.sun.com/javase/6/docs/api/java/awt/event/KeyListener.html#keyTyped%28java.awt.event.KeyEvent%29\"相对=nofollow> 的keyTyped。如果你想保持你当前类的结构,你可以添加空的方法:
It means what it says. You are not implementing the keyReleased method. You're also not implementing keyTyped. If you want to keep your current class structure, you can add empty methods:
public void keyReleased(KeyEvent e){} // ignore
public void keyTyped(KeyEvent e){} // ignore
如果你把监听器在一个单独的(可能是内部)类,你可以扩展的 KeyAdapter ,它为您提供了这些空方法。
If you put the listener in a separate (possibly inner) class, you could extend KeyAdapter, which provides these empty methods for you.
这篇关于库存是不是抽象的,不重写抽象方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!