You can use Scanner class.
For example:
java.util.Scanner in = new java.util.Scanner(System.in);
String input = in.nextLine();
switch (input.toLowerCase()) {
case "a":
System.out.println("Option \"a\" selected;");
break;
case "b":
System.out.println("Option \"b\" selected;");
break;
solved Java (beginner): creating a menu that displays features of a calculator