title: Count uppercase letters in a string
body: <p>I am trying to create a simple program that counts the uppercase characters in a <code>String</code> by looping through each character and incrementing an accumulator variable if the character is uppercase. Here is my code:</p>
  
  <pre><code>String str = "JuSTin"; //3 uppercase characters
  int upperCaseCount = 0; //increment each time an uppercase character is encountered
  char character; //the current character
  for(int i = 0; i &lt; str.length(); i++)
  {
    character = str.charAt(i);
    System.out.println(character); //Log all characters to console just to see what is going on
    if(Character.isUpperCase(character))
        upperCaseCount++; 
    i++;  
  }
  System.out.println("Uppercase characters: " + upperCaseCount);
  </code></pre>
  
  <p>When ran this code outputs: </p>
  
  <pre><code>J
  S
  i
  Uppercase characters: 2
  </code></pre>
  
  <p>What is causing this output? Where is the 'u' 'T' and 'n' in "JuSTin"? Why is <code>upperCaseCount</code> equal to 2 and not 3? </p>