title: How can I find position of first char 's' in the string without using indexOf method
body: <p>So what i'm trying to do is find position of first 's' of the string. So I printed out and output is 7. I want value of indexFirst be 0 since 'she' of the string contains 's'.</p>
  
  <p>I kind of figured out right after I posted the question so thank you</p>
  
  <pre><code>
  public class string 
  {
  
      public static void main(String[] args) 
      {
  
        String str = "she is so nice";
        char replacedFirst = 's';
        int indexFirst = 0;
  
        for(int index = 0; index &lt; str.length(); index++)
        {
          if(str.charAt(index) == replacedFirst)
          {
            indexFirst = index;
          }
        }
        System.out.println(indexFirst);
   }
  
  }
  
  </code></pre>