I'm fairly new to java, so forgive my incompetence. This program is pretty simple, I'm trying to take the string that a user inputs and return the vowels in the string. The error I'm getting is as follows:
> VowelsA3.java:16: error: cannot find symbol
> if (isVowel(letter) == true)
> ^
> symbol: method isVowel(char)
> location: class VowelsA3
> 1 error
Here's my code for "VowelsA3" (my main that will not compile):
import java.util.Scanner;
public class VowelsA3
{
public static void main (String[] args)
{
Scanner scan = new Scanner(System.in);
System.out.println("Please enter a string.");
String userInput = scan.nextLine();
char letter = 'x';
for (int i = 0; i <= userInput.length(); i++)
{
letter = userInput.charAt(i);
if (isVowel(letter) == true)
{
System.out.println(letter);
}
}
}
}
And my method "isVowel" that does compile:
public class isVowel
{
public static boolean isValidVowel(char letter)
{
boolean trueVowel = false;
{
if (letter == 'a' || letter == 'e' || letter == 'i' || letter == 'o' || letter == 'u')
{
trueVowel = true;
}
else
{
trueVowel = false;
}
return trueVowel;
}
}
}
Any ideas? This is my first time creating and working with methods so I'm sure it's something stupid. Sorry if it's a waste of anyone's time.