Created
July 8, 2014 14:39
-
-
Save SlayterDev/cbb13486daab4809e75f to your computer and use it in GitHub Desktop.
Array example
This file contains hidden or 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
public class Arrays { | |
public static void main(String[] args) { | |
// TODO Auto-generated method stub | |
String[] names = new String[5]; | |
names[0] = "Garret"; | |
names[1] = "Calvin"; | |
names[2] = "Ben"; | |
names[3] = "James"; | |
names[4] = "Jeffery"; | |
System.out.println("Brad's Programming 101:"); | |
for (int i = 0; i < names.length; i++) { | |
System.out.println(names[i]); | |
} | |
System.out.println(); | |
char[] myName = {'B', 'r', 'a', 'd'}; | |
System.out.println("My name is: "); | |
for (int i = 0; i < myName.length; i++) { | |
System.out.print(myName[i]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment