hi there, im learning C++ and Java in tandum, this is a java question but i trust you guys so much i dont want to have to sign up to a new forum to get an answer, and you guys have never let me down.
i made an application that took 2 user input ints and printed out the sum with printf.
the book now is telling me to change the program to work with JOptionPane; class instead, so asking via a dialog box for the 2 ints and displaying the sum in a messagebox, this is what i'vr written bu can't work out, tried for ages befotre i came here, hopefully yo ucan help me out! once i know this i think i'll be good to go
import javax.swing.JOptionPane;
publicclass Additions
{
publicstaticvoid main( String args[] )
{
int sum;
String name;
String name2;
String name = // return type string, pane asking for name
JOptionPane.showInputDialog( "What is the first integer?" );
String name2 = // return type string, pane asking for name
JOptionPane.showInputDialog( "What is the second integer?" );
sum = name + name2;
int sum =
String.format( "Sum is %d\n", sum );
}
}