title: Must be an array type but resolved to string
body: <p>I am getting the "Must be an array type but it resolved to string" error in my code. It also says that i (in the code below) cannot be resolved to a variable which I don't get. </p>
  
  <pre><code>    public class DNAcgcount{
  
          public double ratio(String dna){
          int count=0;
          for (int i=0;i&lt;dna.length();i++);
              if (dna[i]== "c"){
              count+= 1;
              if (dna[i]=="g"){
              count+=1;
          double answer = count/dna.length();
          return answer;
  
      }
  
      }
  
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Could you guys please help me figure out where the problem lies? I'm new to coding in Java so I am not entirely comfortable with the format yet.</p>
  
  <p>Thanks a lot,
  Junaid </p>