⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 switchtest.java

📁 java编程思想第四版习题答案
💻 JAVA
字号:
// control/SwitchTest.java
// TIJ4 Chapter Control, Exercise 8, page 153
/* Create a switch statement that prints a message for each case, and put the
* switch inside a for loop that tries each case.  Put a break after each case
* and test it, then remove the breaks and see what happens.
*/

import static net.mindview.util.Print.*;

public class SwitchTest {
	public static void main(String[] args) {
		for(int i = 0; i < 11; i++) {
			switch(i) {
				case 0: print("zero"); break;
				case 1: print("isa"); break;
				case 2: print("dalawa"); break;
				case 3: print("tatlo"); break;
				case 4: print("apat"); break;
				case 5: print("lima"); break;
				case 6: print("anim"); break;
				case 7: print("pito"); break;
				case 8: print("walo"); break;
				case 9: print("siyam"); break;
				default: print("default");
			}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -