0
Can I use if statement in getting user input. If yes then how?
2 Antworten
+ 9
Scanner scnr = new Scanner(System.in);
String input = scnr.nextLine();
if (input.equals("I know what you want to do") )
System.out.println ("Good example,
solves the problem");
else
System.out.println ("An example that
doesn't fit the problem");
+ 1
You could have a check within the statement and have the input in the statement.