1 //if语句 2 //Test10.java 3 4 import java.util.Scanner; 5 6 public class Test16{ 7 public static void main(String[] args){ 8 Scanner in =new Scanner(System.in); 9 System.out.println("请选择类型:"); 10 int style=in.nextInt(); 11 //1:短袖,2:长袖 12 if (style==1){ 13 System.out.println("我要买短袖"); 14 System.out.println("请选择颜色,1白色"); 15 int color=in.nextInt(); 16 if (color==1){ 17 System.out.println("我选择了白色"); 18 }else{ 19 System.out.println("没有该颜色"); 20 } 21 } 22 //System.out.println("xiaodeng"); 23 } 24 }