Can't figure out why int is duplicating in Java
<p>I am creatings a simple Java program that in the main class asks for a string (input) and then prints out how many vowels (int count) and consonants are in the string. The number of vowels works perfectly however the number of consonants double, so the string "James" has 2 vowels and 6 consonants according to my program.</p>

<pre><code>public class counter {

vowels p1 = new vowels();

public int con = 0;

public int count() {

    String input = p1.getInput();

    int i = 0;
    int count = 0;

    while (i &lt; input.length()){

        if (input.charAt(i) == 'a' || input.charAt(i) == 'e' || input.charAt(i) == 'i' || input.charAt(i) == 'o' || input.charAt(i) == 'u') {

        count++;

        } else if (input.charAt(i) != ' ') {
            con++;
        }
    i++;
    }

    return count;

}

public int con() {
    return con;
}
}
</code></pre>