Results 1 to 4 of 4
  1. #1
    jcoon3 is offline Member
    Join Date
    Sep 2009
    Posts
    6
    Rep Power
    0

    Default error cannot find symbol

    public class ReplacementTester
    {
    public static void main(String[] args)
    {
    String greeting = "Hello, elite hacker!";
    String modifiedGreeting = greeting.replace("e, 3");
    modifiedGreeting = modifiedGreeting.replace("l, 7");
    modifiedGreeting = modifiedGreeting.replace("o, 0");
    modifiedGreeting = modifiedGreeting.replace("i, 1");

    System.out.println(modifiedGreeting);
    System.out.println("Expected: H3770, 371t3 hack3r!");
    }
    }
    thats the program


    and in greeting.replace it cant find the . symbol and idk what i did wrong
    Last edited by jcoon3; 09-27-2009 at 07:38 PM.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    What happens if you try replaceAll(...) instead of replace(...)?

    edit: also, you're enclosing the entire parameter in quotes. Don't do that. So instead of
    replace("e, 3"), try replaceAll("e", "3");
    Last edited by Fubarable; 09-27-2009 at 08:01 PM.

  3. #3
    jcoon3 is offline Member
    Join Date
    Sep 2009
    Posts
    6
    Rep Power
    0

    Default

    thanks for the help just adding the other quotes fixed it

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. Replies: 9
    Last Post: 10-18-2008, 09:26 PM
  2. 'Cannot find symbol' error
    By minihazard10 in forum New To Java
    Replies: 6
    Last Post: 10-10-2008, 05:05 AM
  3. Programm Error: cannot find symbol Help?
    By junix in forum New To Java
    Replies: 2
    Last Post: 12-10-2007, 06:30 AM
  4. Error: cannot find symbol
    By silvia in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 06:39 AM
  5. Error: cannot find symbol
    By cachi in forum AWT / Swing
    Replies: 1
    Last Post: 08-06-2007, 09:12 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
  •