switch中的变量声名和使用的问题解决方案
首先错误代码:
public static void main(String[] args) {int type = 2;switch (type) {case 0: {int i = 0;System.out.println(type);break;}case 1: {int i = type;System.out.println(i);break;}case 2: {int i = type;System.out.println(i);break;}case 3: {int i = type;System.out.println(i);break;}}}