Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to use parseInt?

807999Nov 13 2010 — edited Nov 15 2010
I have the following code that fails:

public class AdditionDialogTest {
public static void main( String[] args ){
//Force the user to enter a number
String number1 =
JOptionPane.showInputDialog("Enter fisrt number");

num1 = public static int parseInt(String number1);
}
}

I want to transorm a String number typed by the user into an integer. THe code I want to create has to enter 2 numbers into two dialog boxes and then appear their addition into a
third box using the String message = String.format( "The result of the addition is %d", additionResult ); and JOptionPane.showMessageDialog( null, message );

Please list a code

Thanks
Alexandros

Edited by: 804996 on 13-Nov-2010 08:16
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 13 2010
Added on Nov 13 2010
21 comments
867 views