/*Arrays store a fixed number of values.
*They have many values, but one of the first ways
*you are going to see them is probably going to be
*like the following. Say you declare an array of
type String called names an index of 10...*/
String [ ] names
= new names
[ 9 ] ; //-- (The first index is 0, so the array ends at 9)
//Then you add some values that you want to be stored
names[ 0 ] = PizzaGuy;
names[ 1 ] = GrillMan;
names[ 2 ] = SousChef;
//You create a loop that will get user inputs to store a value in each index
//This can be very convenient. Then you can print them out like:
System .
out .
println ( "You ordered pizza, " + names
[ 0 ] + " is on his way." ) ;
LypBcnJheXMgc3RvcmUgYSBmaXhlZCBudW1iZXIgb2YgdmFsdWVzLiAKKlRoZXkgaGF2ZSBtYW55IHZhbHVlcywgYnV0IG9uZSBvZiB0aGUgZmlyc3Qgd2F5cyAKKnlvdSBhcmUgZ29pbmcgdG8gc2VlIHRoZW0gaXMgcHJvYmFibHkgZ29pbmcgdG8gYmUKKmxpa2UgdGhlIGZvbGxvd2luZy4gU2F5IHlvdSBkZWNsYXJlIGFuIGFycmF5IG9mIAp0eXBlIFN0cmluZyBjYWxsZWQgbmFtZXMgYW4gaW5kZXggb2YgMTAuLi4qLwogIApTdHJpbmdbXSBuYW1lcyA9IG5ldyBuYW1lc1s5XTsgIC8vLS0gKFRoZSBmaXJzdCBpbmRleCBpcyAwLCBzbyB0aGUgYXJyYXkgZW5kcyBhdCA5KQogCi8vVGhlbiB5b3UgYWRkIHNvbWUgdmFsdWVzIHRoYXQgeW91IHdhbnQgdG8gYmUgc3RvcmVkIAogCm5hbWVzWzBdID0gUGl6emFHdXk7Cm5hbWVzWzFdID0gR3JpbGxNYW47Cm5hbWVzWzJdID0gU291c0NoZWY7CiAKLy9Zb3UgY3JlYXRlIGEgbG9vcCB0aGF0IHdpbGwgZ2V0IHVzZXIgaW5wdXRzIHRvIHN0b3JlIGEgdmFsdWUgaW4gZWFjaCBpbmRleAovL1RoaXMgY2FuIGJlIHZlcnkgY29udmVuaWVudC4gVGhlbiB5b3UgY2FuIHByaW50IHRoZW0gb3V0IGxpa2U6CiAKU3lzdGVtLm91dC5wcmludGxuKCJZb3Ugb3JkZXJlZCBwaXp6YSwgIiArIG5hbWVzWzBdICsgIiBpcyBvbiBoaXMgd2F5LiIpOyAgIAog
compilation info
Main.java:7: class, interface, or enum expected
String[] names = new names[9]; //-- (The first index is 0, so the array ends at 9)
^
Main.java:11: class, interface, or enum expected
names[0] = PizzaGuy;
^
Main.java:12: class, interface, or enum expected
names[1] = GrillMan;
^
Main.java:13: class, interface, or enum expected
names[2] = SousChef;
^
Main.java:18: class, interface, or enum expected
System.out.println("You ordered pizza, " + names[0] + " is on his way.");
^
5 errors
stdout