Exercise 5 Exercise5.java l public class Exercise5 { 2- public static void main(String args[]) { Collapse Conditionals -
Posted: Sat Nov 27, 2021 2:26 pm
Exercise 5 Exercise5.java l public class Exercise5 { 2- public static void main(String args[]) { Collapse Conditionals -> Coding Exercise - Conditionals 3 4 String x = args[0]; //add code below this line 5 Exercise 5 6 7 8 //add code above this line Conditionals Exercise 5 9 10 11 } } Problem Use the variable x as you write this program. x will represent a string. Write a program that determines if x is a vowel (a, e, i, o, and u). If yes, print is a vowel , where the blank is the value of x. If no, print _ is not a vowel, where the blank is the value of x. Expected Output • If x is a , then the output would be: a is a vowel • If x is z , then the output would be: z is not a vowel. Comparing Strings If you choose to directly compare Strings, you may be tempted to write x == "a". However, this won't behave as expected. Instead, use .equals() . For example, x.equals("a")