Jordan
2011-06-13 03:11:15 UTC
In this example:
String firstNumber =
JOptionPane.showInputDialog("Enter first integer: ");
String secondNumber =
JOptionPane.showInputDialog("Enter second integer: ");
int number1 = Integer.parseInt(firstNumber);
int number2 = Integer.parseInt(secondNumber);
int sum = number1 + number2;
JOptionPane.showMessageDialogue(null, "The sum is " +sum, "Sum of Two Integers", JOptionPane.PLAIN_MESSAGE)
My questions are:
Why are the variables "firstNumber" and "secondNumber" declared as String? if the expected input is an integer.
What is the use of null?
What is the use of JOptionPane.PLAIN_MESSAGE?
pLEASE explain and provide practical examples.
Please explain it well because I'm new to GUI's
Thank you =(