这个程序怎么运行不了?

yuucyf yuucyf 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
package converttodollar;

import java.io.*;
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;




public class convertToDollar extends Applet implements ActionListener
{
Label label1,label2,label3 ;
TextField textField1,textField2 ;
Button button1 ;

public void init()
{
this.setLayout(new GridLayout(3,2,10,10));
label1 = new Label("人民币") ;
add(label1) ;
textField1 = new TextField(12) ;
add(textField1) ;
label2 = new Label("汇率");
add(label2) ;
textField2 = new TextField(8) ;
add(textField2);
button1 = new Button("转换成为欧元") ;
add(button1) ;
button1.addActionListener(this) ;
label3 = new Label() ;
add(label3) ;
}

public void actionPerformed(ActionEvent e)
{
String s1 = textField1.getText() ;
double x1 = Double.parseDouble(s1) ;
String s2 = textField2.getText() ;
double x2 = Double.parseDouble(s2) ;
double total = x1 * x2 ;
label3.setText("转换后的结果为= " + total + "$") ;

}

}

错误提示:
java.lang.NoSuchMethodError: main
Exception in thread "main"


大家帮忙看看,谢谢了!
...全文

相关推荐

评论 9
收藏 已收藏
分享
返回顶部
yuucyf
Java 51,407 成员 86,133 内容