---
title: "关于java中关于switch的一个注意点"
author: "寻梦者"
date: "2012-11-08T13:01:15Z"
tags: []
categories: ["编程语言"]
slug: "java-switch"
draft: false
lastmod: "2012-11-08T13:01:15Z"
id: 1720245
url: "https://geyubin.iteye.com/blog/1720245"
---

public class TestSwitch {

 

    public static void main(String\[] args) {

        System.out.println(getSwitchValue(3));

    }

 

   public static  int getSwitchValue(int num){

       switch (num) {

        case 1:

            return 1;

        case 2:

            return 2;

        case 3:

        case 4:

        case 5:

            return 5;

        default:

            break;

 

    }

       return 88;    

   }

}

 

 

结果： 5