I need help with this problem, it seems it's not as easy I thought it would be. I've tried some options from early feedbacks but it didn't help. The thing is though that when userinput is like: i dont know the output should be displayed in screen: Sure, Sir Or when user-input is like: I dont know (I with upercase) the output should be: Sure, Sir. Or when user-input is like: idk (i dont know) the output should be: Sure, Sir. But neither of those things are happening so...Help!
import java.util.Scanner;
public class Something{
static void Some(){
Scanner input = new Scanner(System.in);
String answer;
System.out.println("Hello Sir, what can I do for you?");
answer = input.nextLine();
String [] idk = {"I dont know", "i dont know", "idk"};
if(answer.equals(idk)) {
System.out.println("Sure Sir ");
} else {
System.out.println("Sir, anything?");
}
}
public static void main(String [] args) {
Some();
}
}
input: I dont know
or i dont know
or idk
output: Sir, anything?