Results 1 to 3 of 3
  1. #1
    droidus is offline Senior Member
    Join Date
    Feb 2011
    Posts
    244
    Rep Power
    4

    Default "cannot find symbol" error

    I am trying to convert a character to an integer. In the process of doing so, i get this error:

    file.java:19: cannot find symbol
    symbol : method parseInt(char)
    location: class java.lang.Integer
    int intNumber = Integer.parseInt(singleNumber); // Convert char to an int

    Here is my code:

    Java Code:
    for (i=0; i<length; i++) {
    
    	char singleNumber = numberString.charAt(i); // Convert number string to char
    
    	int intNumber = Integer.parseInt(singleNumber); // Convert char to an int
    can't you go from a char to an int?

    thanks in advance.

  2. #2
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,798
    Rep Power
    7

    Default Re: "cannot find symbol" error

    Go to the Java API. Locate the Integer class and then find the parseInt method that takes a character as a parameter. When you have done that you win 10 million dollars.

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. Replies: 5
    Last Post: 04-24-2011, 03:21 PM
  2. "Cannot find symbol" errors in Java
    By 23Zone in forum New To Java
    Replies: 1
    Last Post: 02-17-2010, 07:13 AM
  3. Compiling probem "cannot find symbol"
    By thegluups in forum New To Java
    Replies: 27
    Last Post: 01-18-2010, 08:53 PM
  4. Error "can not find symbol variable"
    By FullMetalHollow in forum New To Java
    Replies: 5
    Last Post: 10-04-2009, 09:51 PM
  5. "Cannont find symbol Constructor" error
    By Welsh in forum New To Java
    Replies: 7
    Last Post: 01-25-2008, 12:12 AM

Posting Permissions

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