JAVA: Syntax การวน loop

package how2dev;

public class How2dev 
{

    public static void main(String[] args) 
	{
		// while loop
		int i = 0;
		while (i<3)
		{
			System.out.println("how2dev.com : while loop");
			i++;
		}
			
		// do while loop
		int j = 0;
		do 
		{
		         System.out.println("how2dev.com : do while loop");
		         j++;
		} while (j < 3);
			
		// for loop
		for(int k=0;k<3;k++)
		{
			System.out.println("how2dev.com : for loop");
		}        
       }
}

Leave a Comment

Your email address will not be published. Required fields are marked *