Hey guys! So I'm writing a program that takes in a user input (1-3) and then executes the corresponding method. I keep getting the wrong output. For example, for prob1 when I input "john doe" it prints "Unauthorized!". And I'm like, foolish computer! I am your MASTER! How can I solve this? Thanks guys!
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.print("Enter problem number: ");
int probNum = s.nextInt();
String probName;
switch (probNum){
case 1: probName = "Case Sensitive Problem";
System.out.print("Input: ");
String strName = s.next();
prob1(strName);
break;
public static String prob1(String strName){
String name = "john doe";
if (strName.equalsIgnoreCase(name))
System.out.print("Welcome John Doe!");
else
System.out.println("Unauthorized!");
return strName;