码迷,mamicode.com
首页 > 编程语言 > 详细

java if语句

时间:2015-09-19 00:54:02      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:

 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 }

 

java if语句

标签:

原文地址:http://www.cnblogs.com/dengyg200891/p/4820665.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!