多种选择:开关盒
import java.util.Scanner; public class Main { public static void main(String arg[]) {/*来自 NowJava.com*/ System.out.print("Input a digit in [0..9]:"); Scanner keyboard = new Scanner(System.in); int n = keyboard.nextInt(); switch (n) { case 0: System.out.println("zero"); break; case 1: System.out.println("one"); break; case 2: System.out.println("two"); break;// from n o w j a v a . c o m case 3: System.out.println("three");