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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Trouble with Integer.parseInt(inputString) in Swing

807598Oct 15 2006 — edited Oct 31 2006
I have JDK1.6.0 and JDK1.5.0_08 with corresponding run times.

IDE: Dr. Java 20060821-1502 which indicates that jdk1.6.0 is in use.

java.class.path C:\Program Files\DrJava\drjava-stable-20060821-1502.exe; C:\Program Files\Java\jdk1.6.0\lib\tools.jar

java.home C:\Program Files\Java\jre1.6.0

When typing in examples from various JAVA books, when the example uses a line like:
int age = Integer.parseInt(stringInput);
It won't compile in Dr. Java or from command line javac ...
error message points to Integer and states symbol not found

My modification to get examples to compile and run:

String myInput;
int monthNumber;

myInput = JOptionPane.showInputDialog("Type in the number" + " of the Month:");

monthNumber = (int) Long.parseLong(myInput);

when I use Long and cast it to int, it works.

Where would I look to discover the contents of the library or class that contains Integer.parseInt()?

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Nov 28 2006
Added on Oct 15 2006
31 comments
793 views