Java While语句

您所在的位置:网站首页 javawhile嵌套循环 Java While语句

Java While语句

2023-04-16 04:22| 来源: 网络整理| 查看: 265

public class Main {

  public static void main(String args[]) throws java.io.IOException {

    char choice;

    do {

      System.out.println("Help on:");

      System.out.println(" 1. A");

      System.out.println(" 2. B");

      System.out.println(" 3. C");

      System.out.println(" 4. D");

      System.out.println(" 5. E");

      System.out.println("Choose one:");

      choice = (char) System.in.read();

    } while (choice  '5');

    System.out.println("\n");

    switch (choice) {

      case '1':

        System.out.println("A");

        break;

      case '2':

        System.out.println("B");

        break;

      case '3':

        System.out.println("C");

        break;

      case '4':

        System.out.println("D");

        break;

      case '5':

        System.out.println("E");

        break;

    }

  }

}



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3