|
|
|
| In C, strings are not first-class types; a string is really just a
null-terminated array of characters. C++ inherits the same type from C,
and also adds a class type string from its class library.
Strings in Java are not null-terminated arrays of characters, as in C/C++. Instead, they are instances of the Java String class. In other words, Strings are fully-fledged objects. This is also true for string literals like "Hello world!". Each string literal is an object of type String. Java defines an operator ( Note: Objects of type String are immutable.
If you want to change the contents of a string, you must either change the reference to the string, or use objects of type StringBuffer.
|
|
This page was last modified on 02 October, 2007 |