以下程序是显示输入的字符串
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class tkeygo extends Applet implements KeyListener
{
String s="";
public void init()
{
}
public void start()
{
addKeyListener(this);
}
public void stop()
{
removeKeyListener(this);
}
public void paint(Graphics g)
{
g.drawString(s,10,10);
}
public void KeyPressed(KeyEvent e){}
public void keyReleased(KeyEvent e){}
public void KeyTyped(KeyEvent e)
{
s=s+e.getKeyChar();
repaint();
}
}
为什么在编译的时候会出错呢?
提示是:
init:
deps-jar:
Compiling 1 source file to D:\Programming\java\keygo\build\classes
D:\Programming\java\keygo\src\tkeygo.java:17: tkeygo 不是抽象的,并且未覆盖 java.awt.event.KeyListener 中的抽象方法 keyReleased(java.awt.event.KeyEvent)
public class tkeygo extends Applet implements KeyListener
1 错误
生成失败(总时间:0 秒)
该如何解决?谢谢!
编译出错!