当前位置:网站首页>switch case使用枚举类来比较
switch case使用枚举类来比较
2022-06-11 00:49:00 【绅士jiejie】
参考代码如下:
//通过valueOf方法获取到具体的枚举,这个type就是真实传进来的要匹配的参数
Enum enum = Enum.valueOf(type);
//switch里的匹配项就是以上得出的枚举
switch (enum) {
//这里的case匹配条件就用我们定义好的枚举实例来做匹配
case enum1:
case enum12:
...}
边栏推荐
- [matlab] image compression coding (DCT, RLE)
- LeetCode 1609 Even Odd Tree (bfs)
- [matlab] basic operation of MATLAB image processing
- MeterSphere教程:接口返回结果为空时如何进行断言
- Task04: String
- Xpath注入
- Interviewer: let me introduce the items in your resume. Tell me more about them, and attach the actual project
- The argument type ‘int?‘ can‘t be assigned to the parameter type ‘num‘
- 中國各省份省會的坐標
- [leetcode] construct a binary tree by traversing the sequence from front to middle (continuous optimization)
猜你喜欢

从解读 BDC 自动生成的代码谈起,讲解 SAPGUI 的程序组成部分试读版

Task07: double pointer

【错误记录】Android 应用安全检测漏洞修复 ( StrandHogg 漏洞 | 设置 Activity 组件 android:taskAffinity=““ )

Loki learning summary (1) -- the best choice of Loki small and medium-sized project log system

Elsevier ---elseviewer--- preprint online publishing notice

Deep exploration of functions with indefinite parameters in C language

基于Gin、Gorm实现的在线练习系统之项目梳理

AI fanaticism | come to this conference and work together on the new tools of AI!

Leetcode 430 flat a multilevel double linked list (DFS linked list)

C语言 深度探究具有不定参数的函数
随机推荐
[image processing] multi functional image processing system based on Matlab GUI [including Matlab source code 1876]
2021-02-27image processing of MATLAB
面试官:介绍一下你简历中的项目,细讲一点,附项目实战
Basic underlying principles of concurrent programming (4)
Elsevier ---elseviewer--- preprint online publishing notice
[leetcode] restore binary search tree
How to reinstall win11 drawing tool when it is missing
Loki learning summary (1) -- the best choice of Loki small and medium-sized project log system
Win11系统使用DISM命令备份驱动程序的方法
并发编程基础底层原理学习(四)
【HaaS Hands-On】全新视频节目上线 创意案例我们一起上手做 第一期E01: 物联网工程师 和你一起上手做遥控机械臂
Initialize the one-dimensional array a correctly
Return function of different return values
LeetCode 1010 Pairs of Songs With Total Durations Divisible by 60 (hash)
Task07: double pointer
【音乐】基于matlab演奏《过火》【含Matlab源码 1875期】
逻辑漏洞 / 业务漏洞
[leetcode] construct a binary tree by traversing the sequence from front to middle (continuous optimization)
LeetCode 1609 Even Odd Tree (bfs)
flutter 状态管理