Hi guys, working through the Deitel Java book and am stumped on one of the cases they give, with no examples, I've tried Googling around but with no success.
The program is just a simple GUI to solve a math problem but the task mentions using the parseInt functio which I can't seem to get to work.
Below is kind of what I've been trying...
Any help much appreciated
import javax.swing.JOptionPane; public class Exercise { public static void main( String[] args ) { int number1; int number2; int sum; String number1 = JOptionPane.showInputDialog( "Enter first number:" ); //number1 = Integer.parseInt(); String number2 = JOptionPane.showInputDialog( "Enter second number:" ); //number2 = Integer.parseInt(); sum = number1 + number2; String message = String.format( "Sum of numbers is %d", sum ); JOptionPane.showMessageDialog( null, message ); } }