小编Ale*_*ang的帖子

Is there any cleaner way to write multiple if-statements in Java

I have an if-else structure in Java as follow:

                    if (A || B || C){
                        if (A){
                            //Do something
                        }
                        if (B){
                            //Do something
                        }
                        if (C){
                            //Do something
                        }
                    } else {
                        //Do something
                    }
Run Code Online (Sandbox Code Playgroud)

I want to know if there is any cleaner and easier way to replace this?

java if-statement

2
推荐指数
1
解决办法
144
查看次数

标签 统计

if-statement ×1

java ×1