Scanner sc = new Scanner (System.in);
String enter = new String ("Enter your name brave soul: ");
System.out.println (enter);
String name = sc.next();
System.out.println ("Your name is: " + name + "? Y/N");
boolean y = true;
boolean n = false;
String yesorno = sc.next();
String intro1 = new String ("Welcome to Urieka! The objective of this game is quite simple, just find the key to escape.");
if (true) {System.out.println (intro1);} //here
else if (false) {System.out.println (enter);} //here
I'm having a problem, I want to print intro1 if the user inputs y and I want the prompt to enter the name if they input it incorrectly. Its currently ONLY printing intro1 regardless if I input y or no.
Furthermore, is there a way for me to run that scanner again because I assume that if I DO get this working and the user inputs n/false, then it would just print "Enter your name brave soul" and nothing else. Would I somehow have to add a scanner into the statement on the else if line?