Results 1 to 3 of 3

Thread: Compile Error

  1. #1
    StevenR is offline Member
    Join Date
    Feb 2013
    Rep Power

    Default Compile Error

    Can somebody check and tell me what the issue is. I get this compiling error and I have no idea what it is telling me. I checked with my teacher and he said the code is correct but it will not compile.
    Java Code:
    C:\Users\Steven Reiche\Documents\JAVA\HomeWork\Chapter 2\TextPad>javac error: cannot find symbol
              age = Integer.parseInt(str);
      symbol:   method parseInt(String)
      location: class Integer
    1 error
    Here is the program code
    Java Code:
    import javax.swing.JOptionPane;
       This program will display an input dialog asking the user
       to input his or her age.
       Then convert the input value to an int and store it in an int variable named age
    public class Age
       public static void main(String[] args)
          String str;
    	  int age;
    		//Ask to input age
    	  str = JOptionPane.showInputDialog("How old are you?");
    	   //convert age to Int
    	  age = Integer.parseInt(str);
          // Display the age
          JOptionPane.showMessageDialog(null, "The age you entered is " + age);

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Washington, DC
    Rep Power

    Default Re: Compile Error

    I do not get that error when compiling. Are you sure you're compiling the correct file?
    How to Ask Questions the Smart Way
    Static Void Games - GameDev tutorials, free Java and JavaScript hosting!
    Static Void Games forum - Come say hello!

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Rep Power

    Default Re: Compile Error

    You haven't got an file located in that directory have you?
    Failing that, is there a CLASSPATH defined in the environment variables?
    If so, then that could be the problem.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Compile error :(
    By Astralogic in forum New To Java
    Replies: 10
    Last Post: 07-22-2013, 03:26 PM
  2. i get this error during compile
    By Bibin in forum New To Java
    Replies: 1
    Last Post: 12-24-2011, 09:43 AM
  3. compile error
    By missmara77 in forum New To Java
    Replies: 1
    Last Post: 10-31-2011, 08:48 PM
  4. Compile Error
    By gcorreageek in forum Advanced Java
    Replies: 2
    Last Post: 09-08-2010, 06:23 AM
  5. Compile Error - Please Help!!
    By AJ2009 in forum New To Java
    Replies: 10
    Last Post: 01-04-2009, 04:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts