Java, How to make java recognize a user input EX: yes or no using if statment?

Hey, I need to make them so whenever my system asks “Are you the best person” that the user answers Yes it is going to go into a different output then once they answer zero.My code to date:

Process.out.println(“Are you a superb person”);
Shield name2 = innovative Scanner (System.in);
String yes;
without a doubt = name2.next();
now when will i do the particular if statement

do for instance this
if(yes.equals(“Yes”)
Process.out.println(“You really are a liar”);
else
Process.out.println(“I know you will be bad”);

You really need to test the particular string’s value to find out if it can be “yes” or maybe “no.” You have available the Chain.equals process.See your Java API specifications.

String s = “lala”;
if(s.equals(“lala”))System.available.println equals \’lala\'”);

Leave a Reply