• Advertisement
Sign in to follow this  

Basic Java Help - Comparing Chars?!

This topic is 3151 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Why wouldn't this work?!?!! It says.. charAt(int) in java.lang.String cannot be applied to (i) Why?
public void speakTurtle(String actions)
{
     for (int i=0; i<actions.length()); i++)
     {
        if (actions.charAt(i)=='F')//Gives me error at i here..
        {
            System.out.println ("Works!");
        }
     }
}



Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement