总结:switch循环,不用break。那么程序每一个case都会运行到,直到遇到break停止

package com.aa;

//格子区域
//3行3列的格子
public class Bu {

	public static int Bu(int x) {
		int j = 1;
		switch (x) {
		case 1:
			j++;
		case 2:
			j++;
		case 3:
			j++;
		default:
			j++;

		}
		return j + x;
	}

	public static void main(String[] args) {
		System.out.println(Bu(2));
	}
}
//
6

  

 

相关文章:

  • 2021-08-27
  • 2021-11-19
  • 2021-09-11
  • 2022-12-23
  • 2021-12-21
  • 2022-12-23
  • 2021-12-10
  • 2021-11-03
猜你喜欢
  • 2021-06-22
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
  • 2021-11-03
相关资源
相似解决方案