Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
Arrays can hold reference types as well as primitive types. You create such an array in much the same way you create an array with primitive types. Here's a small program,ArrayOfStringsDemo
that creates an array containing three string objects then prints the strings in all lower case letters.The output from this program ispublic class ArrayOfStringsDemo { public static void main(String[] args) { String[] anArray = { "String One", "String Two", "String Three" }; for (String s: anArray) { System.out.println(s.toLowerCase()); } } }string one string two string three
Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
Copyright 1995-2005 Sun Microsystems, Inc. All rights reserved.