JAVAでのswitch

524 ワード

		int type = 1;
		switch(type) {
		case 1: {
			Log.d("java-hh", "type is 1.....");
			type = 2;
		}
		break;
		case 2: {
			Log.d("java-hh", "type is 2.....");
		}
		break;
		}
		
		if(type == 1) {
			Log.d("java-hh", "new type is 1.....");
		} else if(type == 2) {
			Log.d("java-hh", "new type is 2.....");
		}

出力:
java-hh   type is 1......
new type is 2......
switch内部でtypeを変更してもswitchの選択値は変更されません...