Can you use conditional statements in switch-case in Android?

前端 未结 7 1117
梦毁少年i
梦毁少年i 2021-02-09 16:07

I can\'t seem to find a straight forward yes or no to this in my searching. In Android, is there a way to use a conditional statement in case-switch? For example, with age being

7条回答
  •  执笔经年
    2021-02-09 16:44

    each case of switch is supposed to be an integer or String since JavaSE 7 and you are trying to feed a boolean value to it so its not possible .Read oracle doc to know about java switch in detail http://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html

提交回复
热议问题