title: Number of vowels within an array
body: <p>I'm trying to write a program which declares and initializes an array of characters (char[] word) and calls the method:</p>
  
  <pre><code>public static int countVowels(char[])
  </code></pre>
  
  <p>which returns the number of vowels in word.</p>
  
  <p>Can anyone tell me where im going wrong? Getting this error</p>
  
  <pre class="lang-none prettyprint-override"><code>java:11: error: char cannot be dereferenced
  for (int j=0; j &lt; word[i].length(); j++) { 
                           ^
  array.java:12: error: char cannot be dereferenced
  char c = word[i].charAt(j); 
                  ^
  2 errors
  </code></pre>
  
  <p> </p>
  
  <pre><code>public class array { 
   public static void main(String[] args) { 
    char[] word = {'a','b','f','u','g','i','o','r'};
  
  }
  public static int countVowels(char[] word) {
  int vowelCount = 0; 
  
  for (int i = 0; i &lt; word.length; i++) 
  { 
      for (int j=0; j &lt; word[i].length(); j++) { 
      char c = word[i].charAt(j); 
      if ( (c == 'a') 
      || (c == 'e') 
      || (c == 'i') 
      || (c == 'o') 
      || (c == 'u') 
      || (c == 'A') 
      || (c == 'E') 
      || (c == 'I') 
      || (c == 'O') 
      || (c == 'U') 
      ) 
      vowelCount++; 
     } 
    } 
   } 
  }
  </code></pre>