So, I'm new to Java, and am doing an exercise to hone my skills. I'm trying to make a method that takes a string and returns to the user how many of what vowel the string has. This is what I have so far
static int[] vowelCount(String english)
{
int a = 0;
int e = 0;
int i = 0;
int o = 0;
int u = 0;
int[] counter = {a, e, i, o, u};
for (int itt = 0; itt < english.length(); itt++)
{
if( english.charAt(itt) == 'a')a++;
if( english.charAt(itt) == 'e')e++;
if( english.charAt(itt) == 'i')i++;
if( english.charAt(itt) == 'o')o++;
if( english.charAt(itt) == 'u')u++;
}
return counter;
}
public static void main(String[] args)
{
System.out.print(vowelCount("Java rocks!"));
}
In this instance, I want my output to be {2,0,0,1,0}, but what I get is "[I@15db9742"