Skip to content

Instantly share code, notes, and snippets.

@panahi
Created September 19, 2012 17:12
Show Gist options
  • Save panahi/3750852 to your computer and use it in GitHub Desktop.
Save panahi/3750852 to your computer and use it in GitHub Desktop.
An example of the java for-each loop
public class Test
{
public static void main(String[] args)
{
int[] example = {1, 2, 3, 4, 5, 6, 7, 8, 9};
for (int i = 0; i < 10; i++)
{
for (int current : example)
{
System.out.print(current);
if (current < 9) System.out.print(", ");
}
System.out.println();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment