Article View: borland.public.jbuilder.java.language
Article #19533String vs. StringBuffers
From: Lewis Chan
Date: Wed, 21 Jan 1998 00:00
Date: Wed, 21 Jan 1998 00:00
17 lines
1078 bytes
1078 bytes
I just started to learn Java. I learned that Strings are constant and
their values cannot be changed after they are created. And that
StringBuffers support mutable strings and should be used if the string
needs to be manipulated.
I created the following class which compiles and runs ok. Therefore, it
seems like I can manipulate a String. Pls help me understand this.
Thanks.
class ChangeString {
public static void main(String args[]) {
String aStr = "string";
aStr = aStr.toUpperCase();
System.out.println(aStr);
}
}
Technical Details
Message-ID:
<34C57F41.37D4@netvigator.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,aa0dcfc1946fc312,start X-Google-Attributes: gidf74b3,public From: Lewis Chan <clewis@netvigator.com> Subject: String vs. StringBuffers Date: 1998/01/21 Message-ID: <34C57F41.37D4@netvigator.com> X-Deja-AN: 317903872 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Organization: None Mime-Version: 1.0 Reply-To: clewis@netvigator.com Newsgroups: borland.public.jbuilder.java.language