|
Question: Can you show me an example of a Java for loop?
Answer: Sure. Here's an example of a Java for loop using the original Java syntax:
package com.devdaily.javasamples;
public class JavaForLoopExample
{
public static void main(String[] args)
{
for (int i=0; i<5; i++)
{
System.out.println("i = " + i);
}
}
}
Java 5 released a slightly newer version of this syntax, and I'll show that in another example as soon as I get it written.
|