Topic: 请教怎么用switch语句改写if语句 |
Print this page |
1.请教怎么用switch语句改写if语句 | Copy to clipboard |
Posted by: snaileagle Posted on: 2005-08-02 17:27 public void actionPerformed(ActionEvent e) { if(e.getSource()==jMS){//jMS 菜单名 test(); } if(e.getSource()==jMK){//jMK 菜单名 sicenec(); } } 怎么用switch语句改写上面的语句啊 |
2.Re:请教怎么用switch语句改写if语句 [Re: snaileagle] | Copy to clipboard |
Posted by: why Posted on: 2005-08-02 18:38 switch only works with integer expression or enumerated type so I don't think it is appropiate to be used here. |
3.Re:请教怎么用switch语句改写if语句 [Re: snaileagle] | Copy to clipboard |
Posted by: snaileagle Posted on: 2005-08-02 18:44 oh , I see ! 看来只有用很多的if语句了,那样的话,程序代码可能会很难看。 |
4.Re:请教怎么用switch语句改写if语句 [Re: snaileagle] | Copy to clipboard |
Posted by: why Posted on: 2005-08-02 20:00 snaileagle wrote: What's the difference between
and
很难看?? |
5.Re:请教怎么用switch语句改写if语句 [Re: snaileagle] | Copy to clipboard |
Posted by: snaileagle Posted on: 2005-08-02 20:52 谢谢,经过你这么比较,呵呵,就不那么觉得了。 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |