title: Java count the vowels program
body: <p>I'm trying to make a program that lets the user input a word, then it will count the number of vowels and consonants in that word and print the amount. e.g: The word 'YOURWORD' contains 3 vowels and 5 consonants. </p>
  
  <p>Since a consonant is just each letter that isn't a vowel, I only made the program check if there was a vowel in the word and then the number of consonants is just the number of other letters in the word. However, I'm struggling with the for loop. Here is my code:</p>
  
  <pre><code>   String word;
      Scanner myinput = new Scanner(System.in);
  
      System.out.println("Please enter a word.");
      word = myinput.next();
      char[] wordc = word.toCharArray();
  
      for(int w = 0;w &gt; word.length();w++;) {
        if(wordc[w] == 'a' || wordc[w] == 'e' || wordc[w] == 'i' || wordc[w] == 'o' || wordc[w] == 'u') {
  
        }
  </code></pre>
  
  <p>As you can see, I'm so close to the end but I literally have no clue what to do now. I'm a beginner at Java and I have checked the for loop syntax but I really don't know what to do, please help.</p>