<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>handy &#187; String</title>
	<atom:link href="http://sirinsevinc.wordpress.com/tag/string/feed/" rel="self" type="application/rss+xml" />
	<link>http://sirinsevinc.wordpress.com</link>
	<description>java,webservice,javascript,software algorithms</description>
	<lastBuildDate>Mon, 20 Jul 2009 14:24:24 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='sirinsevinc.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/22dbbb1103eab00233fa34b9029d78b4?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>handy &#187; String</title>
		<link>http://sirinsevinc.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://sirinsevinc.wordpress.com/osd.xml" title="handy" />
		<item>
		<title>Some Facts about String</title>
		<link>http://sirinsevinc.wordpress.com/2007/12/04/some-facts-about-string/</link>
		<comments>http://sirinsevinc.wordpress.com/2007/12/04/some-facts-about-string/#comments</comments>
		<pubDate>Tue, 04 Dec 2007 18:58:00 +0000</pubDate>
		<dc:creator>sirin sevinc</dc:creator>
				<category><![CDATA[Strings I/O Formatting and Parsing]]></category>
		<category><![CDATA[String]]></category>

		<guid isPermaLink="false">http://sirinsevinc.wordpress.com/2007/12/04/some-facts-about-string/</guid>
		<description><![CDATA[Once you have assigned a String a value, that value can never change— it&#8217;s immutable
To protect the immutability, String class is marked as final. Nobody can override the behaviours of any of the String methods.
To make Java more memory efficient, the JVM sets aside a special area of memory called the &#8220;String constant pool&#8221; When [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sirinsevinc.wordpress.com&blog=2562058&post=8&subd=sirinsevinc&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Once you have assigned a String a value, that value can never change— it&#8217;s immutable<br />
To protect the immutability, String class is marked as final. Nobody can override the behaviours of any of the String methods.</p>
<p>To make Java more memory efficient, the JVM sets aside a special area of memory called the &#8220;String constant pool&#8221; When the compiler encounters a String literal, it checks the pool to see if an identical String already exists. If a match is found, the reference to the new literal is directed to the existing String, and no new String literal object is created. (The existing String simply has an additional reference.)</p>
<p>What is the output of the code below? How many String objects and how many reference variables were created prior to the println statement?</p>
<p>String s1 = &#8220;spring &#8220;;<br />
String s2 = s1 + &#8220;summer &#8220;;<br />
s1.concat(&#8220;fall &#8220;);<br />
s2.concat(s1);<br />
s1 += &#8220;winter &#8220;;<br />
System.out.println(s1 + &#8221; &#8221; + s2);</p>
<p>The result of this code fragment is &#8220;spring winter spring summer&#8221;. There are two reference variables, s1 and s2. There are total of eight String objects created as follows: &#8220;spring&#8221;, &#8220;summer &#8221; (lost), &#8220;spring summer&#8221;, &#8220;fall&#8221; (lost), &#8220;spring fall&#8221; (lost), &#8220;spring summer spring&#8221; (lost), &#8220;winter&#8221; (lost), &#8220;spring winter&#8221; (at this point &#8220;spring&#8221; is lost). Only two of the eight String objects are not lost in this process.</p>
<p>What is the difference between the below methods of creating a String?</p>
<p>String s=&#8221;one&#8221;;<br />
String ss=new String(&#8220;one&#8221;);</p>
<p>First one creates one String object (which is kept in the String constant pool.) and one reference variable.<br />
Second one creates two objects and one reference variable.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sirinsevinc.wordpress.com/8/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sirinsevinc.wordpress.com/8/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sirinsevinc.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sirinsevinc.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sirinsevinc.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sirinsevinc.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sirinsevinc.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sirinsevinc.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sirinsevinc.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sirinsevinc.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sirinsevinc.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sirinsevinc.wordpress.com/8/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sirinsevinc.wordpress.com&blog=2562058&post=8&subd=sirinsevinc&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sirinsevinc.wordpress.com/2007/12/04/some-facts-about-string/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a9d9718257bc3dedcd892134e22b4295?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sirinse</media:title>
		</media:content>
	</item>
	</channel>
</rss>