Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Need help wh a static method for an array.

UNF_StephUNF_Steph Posts: 13Member
I have created a vowel counting program and I'm not sure how to write the static method that accepts the String as a parameter. Can anyone help me write it?

[code]//import statement for ArrayList
import java.util.ArrayList;

public class countingVowels {

public class VowelsProgram
public static void main(String args[])
//create ArrayList that stores String object
ArrayList actor = new ArrayList();

//add Indian actor names to above ArrayList
actor.add("Amitabh Bachan");
actor.add("Kamal Hassan");
actor.add("Shahrukh Khan");
actor.add("Akshay Kumar");

//Write a loop statement that calls countingVowels method for each item in the ArrayList
//and prints number of occurrence of vowels in the item.
int aCounter = 0;
int eCounter = 0;
int iCounter = 0;
int oCounter = 0;
int uCounter = 0;

String line, temp;
int letter;

for (int i=0; i<=letter; i++)

if (line.charAt(i) == 'a')

else if (line.charAt(i) == 'e')

else if (line.charAt(i) == 'i')

else if (line.charAt(i) == 'o')

System.out.println ("Number of 'a': " +aCounter);
System.out.println ("Number of 'e': " +eCounter);
System.out.println ("Number of 'i': " +iCounter);
System.out.println ("Number of 'o': " +oCounter);
System.out.println ("Number of 'u': " +uCounter);


//Write a static countingVowels method that accepts String as parameter.
//this method returns integer array contains count of vowels character
//occurrence in the parameter.

return ;

Sign In or Register to comment.