import javax.swing.JOptionPane; public class hou
{
public static void main(String args[])
{
string fn;
string sn;
int n1;
int n2;
int sum;
fn = JOptionPane.showInputDialog("enter F integer");
sn = JOptionPane.showInputDialog("enter s integer");
n1 = Integer.parseInt("fn");
n2 = Integer.parseInt("sn");
sum =n1+n2;
JOptionPane.showOptionDialog(null,"the sum is"+sum,"RS",JOptionPane.PLAIN_MESSAGE);
system.exit(0);
}
}
{
public static void main(String args[])
{
string fn;
string sn;
int n1;
int n2;
int sum;
fn = JOptionPane.showInputDialog("enter F integer");
sn = JOptionPane.showInputDialog("enter s integer");
n1 = Integer.parseInt("fn");
n2 = Integer.parseInt("sn");
sum =n1+n2;
JOptionPane.showOptionDialog(null,"the sum is"+sum,"RS",JOptionPane.PLAIN_MESSAGE);
system.exit(0);
}
}
string fn;
string sn;
int n1;
int n2;
int sum;
这些就初始化下 撒。写的不错啊。。
JOptionPane.showOptionDialog(null,"the sum is"+sum,"RS",JOptionPane.PLAIN_MESSAGE,JOptionPane.ERROR_MESSAGE,null,null,null);
另外String,System都拼写错了,开头的S是大写的
JOptionPane.showOptionDialog(null,"the sum is"+sum,"RS",JOptionPane.PLAIN_MESSAGE,null,"the sum is"+sum,"RS",JOptionPane.PLAIN_MESSAGE,JOptionPane.ERROR_MESSAGE,null,null,null);
^
E:\java\hou2.java:24: 找不到符号
符号: 变量 system
位置: 类 hou2
system.exit(0);
^
2 错误
怎么改啊
你这个参数不错才怪,自己检查一下就能返现的,你把参数写了两遍
还有符号: 变量 system 改为System.exit(0);注意大写S