title: Methods and Strings
body: <p>I am new to Java programming. My homework problem states that to Write a program that calls a method to print the number of vowels in a sentence (use ‘nextLine()’to read a sentence instead of a single word).  Print the number of occurrences of each vowel (ie: the number of ‘a’s, the number of ‘e’s, etc.) Here is my program so far</p>
  
  <pre><code>public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
  
    System.out.println("Enter a string");
    String str = in.nextLine();
  
  
    System.out.println("The number a vowels in the sentence are" + vowel(str));
  }
  
    public static String vowel(str)//I'm having trouble here
  {
      int len = str.length(); // Here
      int count = 0;
      for (int i = 0; i &lt; len; i++)
      {
         char str2 = str.charAt(i);//Here
         if (str2 == 'a')
         count++;    
      }
         return str2; // And finally here
   }
  </code></pre>