Problem statement:
Please check whether vowels present in the given String or not
Sample input1: india
Sample output1: Vowels present in the String
Sample input2: bbc
Sample output2: Vowels not present in the string
Solution:
public void checkVowelsInString() {
System.out.println("checkVowelsInString:");
System.out.println("-----------------------");
String input="sssss";
if(input.matches(".*[aeiou].*")) {
System.out.println("Vowels present in string");
}
else {
System.out.println("Vowels not present in string");
}
System.out.println("==============================================\n\n");
}
Output: Vowels not present in the string
No comments:
Post a Comment