Switch case logical expression statement in Java - versus JS or PHP

前端 未结 2 397
醉梦人生
醉梦人生 2021-01-25 20:32

in JavaScript and also I\'ve seen it in PHP : You can use a logical expression inside you cases : For Example :

switch(true){
case (d<10):
document.write(\"Le         


        
2条回答
  •  迷失自我
    2021-01-25 21:00

    No You cannot do that using switch in java. You have to use if-else to accomplish this.

    See this link for more details.

提交回复
热议问题