---
spec: JLS
title: "The Java Language Specification"
edition: "Java SE 20 Edition"
java_version: 20
chapter: "Chapter 10. Arrays"
section: "10.9"
heading: "10.9. An Array of Characters Is Not a String"
parent: "Chapter 10. Arrays"
source: https://docs.oracle.com/javase/specs/jls/se20/html/jls-10.html#jls-10.9
id: "10.9"
url: https://jvm.obfuscated.software/jls/se20/10.9.html
raw: https://jvm.obfuscated.software/jls/se20/10.9.md
---

# 10.9. An Array of Characters Is Not a `String`

In the Java programming language, unlike C, an array of `char` is not a `String`, and neither a `String` nor an array of `char` is terminated by '`\u0000`' (the NUL character).

A `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.
