Created
March 29, 2015 16:11
-
-
Save ecornell/190a7385d61c62c30bf8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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