http://alvinalexander.com/java/java-string-array-reference-java-5-for-loop-syntax
public
class
JavaStringArrayTests2
{
private
String[] toppings = {
"Cheese"
,
"Pepperoni"
,
"Black Olives"
};
// our constructor; print out the String array here
public
JavaStringArrayTests2()
{
<b>
for
(String s: toppings)
{
System.out.println(s);
}</b>
}
// main kicks everything off.
// create a new instance of our class here.
public
static
void
main(String[] args)
{
new
JavaStringArrayTests2();
}
}
No comments:
Post a Comment