This program is short and sweet, just having the computer output if the letter is uppercase or lowercase, or not valid. But it seems to skip the code and go directly to "You did not type a valid input"
. How do I get it to recognize the other options and work correctly?
Here is the code:
import java.util.*;
public class StringTest2 {
public static void main(String[] args) {
System.out.println("uppercase (U/u) or lowercase (L/l)?");
Scanner console = new Scanner(System.in);
String input = console.nextLine();
if (input == "U" || input == "u") {
System.out.println("uppercase!" + input);
} else if (input == "L" || input == "l") {
System.out.println("lowercase!" + input);
} else {
System.out.println("You did not type a valid input " + input);
}
}
}