- <p>public class Test
- {
- public static void main(String[] args)
- {
- for (int i =1; i < 5; i++)
- {
- switch (i)
- {
- case 1:
- System.out.println("1111111");
- break;
- default:
- System.out.println("kkkkkkk"); //这里少了个break,所以输出后会接下来输出case 2: 要不加个break或者把default 放末位</p><p>
- case 2:
- System.out.println("2222222");
- break;
- }
- }
- }
- }</p>
复制代码
|