I'm creating a text-based RPG for my AP computer Science final Project and I want to make it so that at any point the player can type "help" and it will display a message in the console. The only way I can think to do it would be to use the Scanner import and do something like:
String help = scan.nextLine();
switch(help) {
case help:
System.out.println("help message");
break;
}
I've been teaching myself Java for the project I'm very new and I'm aware this is probably an extremely inefficient method for this, not to mention it would only work at 1 point. So if someone could point me in the right direction I'd be eternally grateful. Also: I have searched for the answer before submitting this post but I couldn't find one that described how to print it to the console throughout the game.