---
# System prepended metadata

title: 074 TestWhile.java + TestDoWhile.java

---

# 074 TestWhile.java + TestDoWhile.java

1.TestWhile.java 
/*此範例為while迴圈測試*/

public class TestWhile {

	public static void main(String[] args) {
		int i = 100;

		while (i <= 10) {
			System.out.println(i);
			i++;
		}

		System.out.println("------------------------------");
		{
		int count = 1;
		while (count++ < 5)
			System.out.println("count = " + count);}
	
	
	System.out.println("------------------------------");
    

---

2.TestDoWhile.java
/*此範例為do-while迴圈測試*/

	    int j = 100;
        do {
		     System.out.println(j);
		      j++;
	        } while (j <=10);}

}

