我想知道如何根据用户输入打印特定的句子。
在下面的场景中,如果用户输入“B”,我想打印“您已选择 B”,但是如果用户选择 CI,则希望打印“您已选择 C”。
import java.util.Scanner;
public class Trial extends Register
{
//I want to load the register which will be option B
public static void main (String[] args)
{
Scanner input = new Scanner(System.in);
System.out.println("Enter A to make a purchase & receive your change");
System.out.println("Enter B to load the Register");
System.out.println("Enter C to write the contents of the Register to a
web Page");
System.out.println("Enter D to exit the program");
}