I'm trying to practice for a techniqual test where I have to count the number of characters in a DNA sequence, but no matter what I do the counter won't update, this is really frustrating as I learnt code with ruby and it would update, but Java seems to have an issue. I know there's something wrong with my syntaxt but for the life of me I can't figure it out.
public class DNA {
  public static void main(String[] args) {
    String dna1 = "ATGCGATACGCTTGA";
    String dna2 = "ATGCGATACGTGA";
    String dna3 = "ATTAATATGTACTGA";
    String dna = dna1;
    int aCount = 0;
    int cCount = 0;
    int tCount = 0; 
    for (int i = 0; i <= dna.length(); i++) {
      if (dna.substring(i) == "A") {
        aCount+= 1;
      }
      else if (dna.substring(i) == "C") {
        cCount++;
      } 
      else if (dna.substring(i) == "T") {
        tCount++;
      }
      System.out.println(aCount);
    } 
  }
}
It just keeps returning zero instead of adding one to it if the conditions are meet and reassigning the value.
 
     
     
     
     
    