Specifications
Sun Services
Java™ Programming Language
Module 5, slide 5 of 15
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
Creating Arrays
Use the new keyword to create an array object.
For example, a primitive (char) array:
1 public char[] createArray() {
2 char[] s;
3
4 s = new char[26];
5 for ( int i=0; i<26; i++ ) {
6 s[i] = (char) (’A’ + i);
7}
8
9 return s;
10 }










