[求助]下下面的程序问题出在哪
下面的程序是我在书上抄下来的,老是说number1,number2没有初始化,我也不知道是哪抄错了,哪位仁兄帮我看看是哪的问题import javax.swing.JOptionPane;
public class Product
{
public static void main(String args[])
{
String firstNumber;
String secondNumber;
int number1;
int number2;
int product;
firstNumber=JOptionPane.showInputDialog("输入乘数");
secondNumber=JOptionPane.showInputDialog("输入被乘数");
try{
number1=Integer.parseInt(firstNumber);
number2=Integer.parseInt(secondNumber);
}
catch(NumberFormatException ex){
JOptionPane.showMessageDialog(null,"你有输入错误","消息",
JOptionPane.PLAIN_MESSAGE);
System.exit(0);
}
product=number1 * number2;
JOptionPane.showMessageDialog(null,number1+"*"+number2+"="+product,
"结果",JOptionPane.PLAIN_MESSAGE);
System.exit(0);
}
}