Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

String API Specification is wrong

807580May 18 2010 — edited May 19 2010
In the API Specification [http://java.sun.com/javase/6/docs/api/java/lang/String.html] it says:

Strings are constant; their values cannot be changed after they are created. String buffers support mutable strings. Because String objects are immutable they can be shared. For example:
String str = "abc";
is equivalent to:
char data[] = {'a', 'b', 'c'};
String str = new String(data);
This is clearly wrong as they are not equivalent. new String(data) will always create a new instance, whereas "abc" always refers to the same instance.

??

Comments

Processing
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 16 2010
Added on May 18 2010
41 comments
263 views