码迷,mamicode.com
首页 > 其他好文 > 详细

第四章

时间:2017-04-09 17:28:19      阅读:133      评论:0      收藏:0      [点我收藏+]

标签:获取   执行   ==   购物   开关   stat   第四章   管理   cas   

public class Dfdg {
示例2

 public static void main(String[] args) {
  int mingCi = 1;   //名次
  switch (mingCi){   //开关
  case 1:    //案列1
   System.out.println("一等奖");
   break;
  case 2:
   System.out.println("二等奖");
   break;
  case 3:
   System.out.println("三等奖");
      break;
  default:
   System.out.println("没有任何奖励");
   break;
  }
 }

}
/*一等奖*/

示例4

public static void main(String[] args) {

 System.out.println("\n\t\t欢迎使用我行我素购物管理系统1.0版\n");

System.out.println("\t\t\t1.登 陆 系 统");

System.out.println("\t\t\t2.退 出");

System.out.println(" * * * * * * * * * * * * * * * * * * * * * * * *");

System.out.println("请选择,输入数字:");

/*从键盘上获取信息,并执行相应操作---新加代码*/

Scanner input = new Scanner (System.in);

if(input.hasNextInt() ==true){

     int  num = input.nextInt();

     switch(num) {

     case 1:

        //省略

     break;

     case 2:

      /*退 出 系 统*/

      System.out.println("谢谢您的使用!");

      break;

 default:

      System.out.println("输 入 错 误。");

      break;

   }

}else {

      System.out.println("请输入正确的数字!");

      }

   }

}    

 

第四章

标签:获取   执行   ==   购物   开关   stat   第四章   管理   cas   

原文地址:http://www.cnblogs.com/w1532519588/p/6685138.html

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