Results 1 to 3 of 3
  1. #1
    Jack9333 is offline Member
    Join Date
    Mar 2011
    Posts
    2
    Rep Power
    0

    Unhappy [SOLVED] HELP! can't find symbol-method

    Ok, I'm stumped on this one. I can't figure out why I can't use my delete() method inside the body of my deleteAll() method. It seems like it should work, but It does not!!! Im thinking it has to do with the scope of the method but I can't get any farther than that.:confused:

    Any input would be greatly appriciated, thanks!

    public class LineEditor
    {
    private String myLine;
    private String begening, end;

    public void insert(String str, int index)
    {
    begening = myLine.substring(0, index);
    end = myLine.substring((index), myLine.length());
    myLine = begening + str + end;
    }

    public void delete (String str)
    {
    if (myLine.indexOf(str)!=-1)
    {
    begening = myLine.substring(0, (myLine.indexOf(str)));
    end = myLine.substring((begening.length()+str.length()), myLine.length());
    }
    }

    public void deleteAll (String str)
    {
    while (myLine.indexOf(str) != -1)
    {
    myLine.delete(str);
    }
    }
    }
    Last edited by Jack9333; 03-04-2011 at 02:20 AM. Reason: question anwsered

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

    Default

    The myLine variable is a String. The delete method is in your class not the String class.

  3. #3
    Jack9333 is offline Member
    Join Date
    Mar 2011
    Posts
    2
    Rep Power
    0

Similar Threads

  1. Replies: 10
    Last Post: 12-22-2010, 01:12 AM
  2. cannot find symbol - method iterator()
    By D.Calladine in forum New To Java
    Replies: 1
    Last Post: 11-30-2010, 12:13 PM
  3. Replies: 8
    Last Post: 10-17-2010, 10:24 AM
  4. Replies: 9
    Last Post: 10-18-2008, 08:26 PM
  5. Replies: 3
    Last Post: 05-01-2008, 08:30 AM

Tags for this Thread

Posting Permissions

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