集册 Java实例教程 在switch语句中使用字符串文字

在switch语句中使用字符串文字

欢马劈雪     最近更新时间:2020-01-02 10:19:05

491
在switch语句中使用字符串文字

public class Main {/** 时 代 J a v a - N o w J a v a . c o m 提 供 **/


  public static void main(String[] args) {

    for (String argument : args) {

      switch (argument) {

      case "-verbose":

      case "-v":

        System.out.println("-v");

        break;

      case "-log":

        System.out.println("-log");

        break;

      case "-help":

        System.out.println("-help");

        break;

    
展开阅读全文