| CHAPTER 10: Arrays |
Previous |
Java Language |
Index |
Next |
In Java, unlike C, an array of char is not a String (S20.12), and neither a String nor an array of char is terminated by '\u0000' (the NUL character).
A Java String
object is immutable, that is, its contents never change, while an array of char
has mutable elements. The method toCharArray
in class String
returns an array of characters containing the same character sequence as a String
. The class StringBuffer
implements useful methods on mutable arrays of characters (S20.13).
| © 1996 Sun Microsystems, Inc. All rights reserved. |