查看: 1444|回复: 2
|
Java上的问题
[复制链接]
|
|
public class gui {
String fn=JOptionPane.showInputDialog("Enter Your First Name");
String sn=JOptionPane.showInputDialog("Enter Your Last Name");
int num1=Integer.parseInt(fn);
int num2=Integer.parseInt(sn);
JOptionPane.showMessageDialog(null,"The answer is"+sum,"the title",JOptionPane.PLAIN_MESSAGE);
}
JOptionPane.PLAIN_MESSAGE这里怎么一直出现error?
|
|
|
|
|
|
|
|
发表于 17-11-2015 12:27 PM
|
显示全部楼层
你确定你把code 都放上来了吗? 你的sum 从哪里来的?而且你把全部东西放在class body 是不行的,你必须放这些在method body,
- public class gui(
- public void init(){
- //code go here
- }
- public static void main(String[] args){
- new gui().init();
- }
- }
-
复制代码
之类的。
|
评分
-
查看全部评分
|
|
|
|
|
|
|

楼主 |
发表于 17-11-2015 12:42 PM
|
显示全部楼层
|
|
|
|
|
|
| |
本周最热论坛帖子
|