zoukankan      html  css  js  c++  java
  • 每日总结

    今天复习的是Java中的程序流程控制,这方面的知识在C语言中也学习过,但是掌握得并不是很牢固。

    所以在复习的过程中加深印象。

    其中switch选择结构的代码如下:

    public class Main {

    public static void main(String[] args) {
    // TODO Auto-generated method stub
    System.out.println("请输入密码:");
    Scanner con=new Scanner(System.in);
    //用户从键盘输入密码
    String line=con.nextLine();
    //如果密码等于123456则跳转至主页面
    //Java中字符串内容相同用equals比较
    if(line.equals("123456")) {
    System.out.println("1、取款");
    System.out.println("2、退出");
    int num=con.nextInt();
    switch(num) {
    case 1:
    System.out.println("1、取款200元");
    System.out.println("2、取款500元");
    System.out.println("3、取款1000元");
    System.out.println("4、其他金额");
    int money=con.nextInt();
    switch(money) {
    case 1:
    System.out.println("取出了200元!");
    break;
    case 2:
    System.out.println("取出了500元!");
    break;
    case 3:
    System.out.println("取出了1000元!");
    break;
    case 4:
    System.out.println("请输入取款金额:");
    int other=con.nextInt();
    System.out.println("取出了"+other+"元!");
    break;
    }
    break;
    case 2:
    System.out.println("谢谢您的使用!退出!");
    break;
    }
    }
    }

  • 相关阅读:
    js中Unicode转义序列
    css相对定位和绝对定位
    C#默认以管理员身份运行程序
    asp.net判断是否代理
    JS上传图片选择后立即预览
    asp.net判断是刷新还是提交
    查询QQ好友的IP地址(二)
    查询QQ好友的IP地址(一)
    Hadoop综合大作业+补交平时作业
    熟悉常用的Hbase操作
  • 原文地址:https://www.cnblogs.com/lxywsx/p/14173820.html
Copyright © 2011-2022 走看看