阅读下面程序import javax.swing.JOptionPane;public class Comparison{public static void main(String args[]){String firstNumber, //用户输入第1个数据变量second Number, //用户输入第2个数据变量result; //输出结果变量int number1, //用于比较的第1个数number2; //用于比较的第2个数//用户输入第1个数据的字符串firstNumber=JOptionPane. showInputDialog(“输入第1个整数:”);//用户输入第2个数据的字符串secondNumber=JOptionPane.showlnputDialog(“输入第2个整数:”);//将字符串转换为整数类型number1=Integer.parseInt(firstNumber);number2=Integer.parseInt(secondNumber);//初始化结果变量___________________;//比较两个数据if(number1=number2)result += number1 +" =" + number2;if(number1 != number2 )result += numberl +" !=" + number2;if( number1 < number2 )result = result + "\n" + numberl +" <" + number2;if(number1 > number2 )result = result + "\n" + number1 + ">" + number2;if( number1 <= number2 )result = result + "\n" + number1 +" <=" + number2;if (number1 >= number2 )result = result + "\n" + number1 + ">=" + number2;//显示结果JOptionPane.showMessageDialog(null,result," 比较结果",JOptionPane. INFORMATION_MESSAGE);System.exit(0);}}为使程序能正确运行并得到合理的输出结果,初始化结果变量语句(下划线处)应是A.result = ""B.result = nullC.result = number1D.result = number2
阅读下面程序
import javax.swing.JOptionPane;
public class Comparison{
public static void main(String args[]){
String firstNumber, //用户输入第1个数据变量
second Number, //用户输入第2个数据变量
result; //输出结果变量
int number1, //用于比较的第1个数
number2; //用于比较的第2个数
//用户输入第1个数据的字符串
firstNumber=JOptionPane. showInputDialog(“输入第1个整数:”);
//用户输入第2个数据的字符串
secondNumber=JOptionPane.showlnputDialog(“输入第2个整数:”);
//将字符串转换为整数类型
number1=Integer.parseInt(firstNumber);
number2=Integer.parseInt(secondNumber);
//初始化结果变量
___________________;
//比较两个数据
if(number1=number2)
result += number1 +" =" + number2;
if(number1 != number2 )
result += numberl +" !=" + number2;
if( number1 < number2 )
result = result + "\n" + numberl +" <" + number2;
if(number1 > number2 )
result = result + "\n" + number1 + ">" + number2;
if( number1 <= number2 )
result = result + "\n" + number1 +" <=" + number2;
if (number1 >= number2 )
result = result + "\n" + number1 + ">=" + number2;
//显示结果
JOptionPane.showMessageDialog(null,result," 比较结果",
JOptionPane. INFORMATION_MESSAGE);
System.exit(0);
}
}
为使程序能正确运行并得到合理的输出结果,初始化结果变量语句(下划线处)应是
A.result = ""
B.result = null
C.result = number1
D.result = number2