专家们来看看这段程序,它怎么错拉?在线等待!!!!!!!!

carlchen2002 2003-01-14 11:15:59
import java.awt.*;
import java.awt.event.*;
import java.awt.event.ActionEvent;
public class carlchen3
{
public static void main (String args[])
{
new m();
}
}
class m extends Frame implements ActionListener
{
TextField input,output;

m()
{
super("ciherfh");
input=new TextField(6);
output=new TextField(20);
setLayout(new FlowLayout());
add(input);
add(output);
input.addActionListener(this);
setSize(200,300);
show();
}
public void actionperformed(ActionEvent e)
{
output.setText(input.getText());
}
}


编译后出现了这样的异常:
carlchen3.java:11: m 必须声明为 abstract; 它没有在 m 中定义 actionPerformed(java
.awt.event.ActionEvent)
class m extends Frame implements ActionListener
^
1 个错误
...全文
23 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
lkenshin 2003-01-15
  • 打赏
  • 举报
回复
有分没?
hoxisoft 2003-01-15
  • 打赏
  • 举报
回复
hehe
colors 2003-01-15
  • 打赏
  • 举报
回复
我也晚了
liujuntao 2003-01-15
  • 打赏
  • 举报
回复
晚了!哎
up
BenLadeng5225 2003-01-15
  • 打赏
  • 举报
回复
改成:
import java.awt.*;
import java.awt.event.*;
import java.awt.event.ActionEvent;
public class carlchen3
{
public static void main (String args[])
{
new m();
}
}
class m extends Frame implements ActionListener
{
TextField input,output;

m()
{
super("ciherfh");
input=new TextField(6);
output=new TextField(20);
setLayout(new FlowLayout());
add(input);
add(output);
input.addActionListener(this);
setSize(200,300);
show();
}
public void actionPerformed(ActionEvent e)
{
output.setText(input.getText());
}
}
希偌 2003-01-14
  • 打赏
  • 举报
回复
写错了
public void actionperformed(ActionEvent e)
{
output.setText(input.getText());
}
-->
public void actionPerformed(ActionEvent e)//actionPerformed里的P要大写
{
output.setText(input.getText());
}

62,628

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧