Skip to content

Instantly share code, notes, and snippets.

@ecornell
Created March 29, 2015 16:11
Show Gist options
  • Save ecornell/190a7385d61c62c30bf8 to your computer and use it in GitHub Desktop.
Save ecornell/190a7385d61c62c30bf8 to your computer and use it in GitHub Desktop.
/**
* Created by Elijah on 3/29/2015.
*/
public class ForEach {
public static void main(String[] args) {
String[] array = { "a", "b", "c"};
System.out.println("-- FOR LOOP --");
for (int i = 0; i < array.length; i++) {
String s = array[i];
System.out.println( "for -> " + s );
}
System.out.println("\n-- FOR/EACH LOOP --");
for (String s : array) {
System.out.println( "foreach -> " + s );
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment