public class ForLoopExample2
{
public static void main(String args[])
{
// ForLoopExample2
int x;
for (x = 0; x < 5; x++)
{
System.out.println(x);
}
System.out.println("x is now " + x);
}
}
0 1 2 3 4 x is now 5
--- Output Ends ---
- javac ForLoopExample2.java
- java ForLoopExample2