Source code for ForLoopExample1.java:

public class ForLoopExample1
{
	public static void main(String args[])
	{
		// ForLoopExample1
		for (int x = 0; x < 5; x++)
		{
			System.out.println(x);
		}
	}
}

Output from ForLoopExample1.java:

0 1 2 3 4

--- Output Ends ---

NOTE:

You are reading previously generated output. You are not currently running the ForLoopExample1 application at the momement. You need to compile and run the source code first.

To run this program:


Authors: Kevin Chu and Eric Brower
Copyright 2000 Prentice Hall PTR