<?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>techhangout &#124; non-political rants on software development</title>
	<atom:link href="http://techhangout.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://techhangout.wordpress.com</link>
	<description>non-political rants on software development</description>
	<lastBuildDate>Wed, 17 Aug 2011 16:24:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='techhangout.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/eff7d0640c9ab0e5e406054eb399f10e?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>techhangout &#124; non-political rants on software development</title>
		<link>http://techhangout.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://techhangout.wordpress.com/osd.xml" title="techhangout &#124; non-political rants on software development" />
	<atom:link rel='hub' href='http://techhangout.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Search For Android .apk files in Google</title>
		<link>http://techhangout.wordpress.com/2011/04/09/search-for-android-apk-files-in-google/</link>
		<comments>http://techhangout.wordpress.com/2011/04/09/search-for-android-apk-files-in-google/#comments</comments>
		<pubDate>Sat, 09 Apr 2011 23:07:16 +0000</pubDate>
		<dc:creator>Saj</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[apk]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[mobile-apps]]></category>

		<guid isPermaLink="false">http://techhangout.wordpress.com/?p=180</guid>
		<description><![CDATA[To search for all apk files, in Google, type- -inurl:htm -inurl:html intitle:&#8221;index of&#8221; apk To search for games- -inurl:htm -inurl:html intitle:&#8221;index of&#8221; apk games To search for a specific app- -inurl:htm -inurl:html intitle:&#8221;index of&#8221; apk AngryBirds Have fun!<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=techhangout.wordpress.com&amp;blog=1572005&amp;post=180&amp;subd=techhangout&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>To search for all apk files, in Google, type-</p>
<p><a title="Apk Search" href="http://www.google.com/search?sourceid=chrome&amp;ie=UTF-8&amp;q=-inurl%3Ahtm+-inurl%3Ahtml+intitle%3A%22index+of%22+apk">-inurl:htm -inurl:html intitle:&#8221;index of&#8221; apk</a></p>
<p>To search for games-</p>
<p><a title="Game Apk Search" href="http://www.google.com/search?sourceid=chrome&amp;ie=UTF-8&amp;q=-inurl%3Ahtm+-inurl%3Ahtml+intitle%3A%22index+of%22+apk+games">-inurl:htm -inurl:html intitle:&#8221;index of&#8221; apk games</a></p>
<p>To search for a specific app-</p>
<p><a title="Specific App Apk File Search" href="http://www.google.com/search?sourceid=chrome&amp;ie=UTF-8&amp;q=-inurl%3Ahtm+-inurl%3Ahtml+intitle%3A%22index+of%22+apk+AngryBirds">-inurl:htm -inurl:html intitle:&#8221;index of&#8221; apk AngryBirds</a></p>
<p>Have fun!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/techhangout.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/techhangout.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/techhangout.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/techhangout.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/techhangout.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/techhangout.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/techhangout.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/techhangout.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/techhangout.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/techhangout.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/techhangout.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/techhangout.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/techhangout.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/techhangout.wordpress.com/180/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=techhangout.wordpress.com&amp;blog=1572005&amp;post=180&amp;subd=techhangout&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://techhangout.wordpress.com/2011/04/09/search-for-android-apk-files-in-google/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04625e9362d332cc1dad3efa6a2a4328?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Saj</media:title>
		</media:content>
	</item>
		<item>
		<title>App Inventor: No Need For Signing Up. Open to All</title>
		<link>http://techhangout.wordpress.com/2010/12/19/app-inventor-no-need-for-signing-up-open-to-all/</link>
		<comments>http://techhangout.wordpress.com/2010/12/19/app-inventor-no-need-for-signing-up-open-to-all/#comments</comments>
		<pubDate>Sun, 19 Dec 2010 15:52:10 +0000</pubDate>
		<dc:creator>Saj</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[app-inventor]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[mobile-apps]]></category>

		<guid isPermaLink="false">http://techhangout.wordpress.com/?p=177</guid>
		<description><![CDATA[App Inventor no longer requires signing up for access. Got a gmail account? So what are you waiting for? Visit the link and start developing for your android phones.  You are not much of a developer? Don&#8217;t like writing code? With App Inventor, you don&#8217;t need to. Visit and see what Google got for you!<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=techhangout.wordpress.com&amp;blog=1572005&amp;post=177&amp;subd=techhangout&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a title="App Inventor" href="http://appinventor.googlelabs.com">App Inventor</a> no longer requires signing up for access. Got a gmail account? So what are you waiting for? Visit the link and start developing for your android phones.  You are not much of a developer? Don&#8217;t like writing code? With App Inventor, you don&#8217;t need to. Visit and see what <a title="Google" href="http://www.google.com">Google </a>got for you!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/techhangout.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/techhangout.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/techhangout.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/techhangout.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/techhangout.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/techhangout.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/techhangout.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/techhangout.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/techhangout.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/techhangout.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/techhangout.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/techhangout.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/techhangout.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/techhangout.wordpress.com/177/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=techhangout.wordpress.com&amp;blog=1572005&amp;post=177&amp;subd=techhangout&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://techhangout.wordpress.com/2010/12/19/app-inventor-no-need-for-signing-up-open-to-all/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04625e9362d332cc1dad3efa6a2a4328?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Saj</media:title>
		</media:content>
	</item>
		<item>
		<title>Job Board &#8211; Flash Developer &#124; Work from Home</title>
		<link>http://techhangout.wordpress.com/2010/04/05/job-board-flash-developer-work-from-home/</link>
		<comments>http://techhangout.wordpress.com/2010/04/05/job-board-flash-developer-work-from-home/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 16:58:26 +0000</pubDate>
		<dc:creator>Saj</dc:creator>
				<category><![CDATA[Job]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[developer]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[programmer]]></category>
		<category><![CDATA[work from home]]></category>

		<guid isPermaLink="false">http://techhangout.wordpress.com/?p=164</guid>
		<description><![CDATA[Good at Adobe Flash? Wanna work from home? Hit the link below. If you think I know you in person, leave a message. I will see if I can recommend you. Good luck! http://www.itpinoy.com/job/1826/flash-developers-home-based-at-id-leaders-three19/<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=techhangout.wordpress.com&amp;blog=1572005&amp;post=164&amp;subd=techhangout&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h3>Good at Adobe Flash? Wanna work from home? Hit the link below. If you think I know you in person, leave a message. I will see if I can recommend you. Good luck!</p>
<p><a rel="nofollow" href="http://www.itpinoy.com/job/1826/flash-developers-home-based-at-id-leaders-three19/" target="_blank">http://www.itpinoy.com/job/1826/flash-developers-home-based-at-id-leaders-three19/</a></h3>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/techhangout.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/techhangout.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/techhangout.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/techhangout.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/techhangout.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/techhangout.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/techhangout.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/techhangout.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/techhangout.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/techhangout.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/techhangout.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/techhangout.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/techhangout.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/techhangout.wordpress.com/164/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=techhangout.wordpress.com&amp;blog=1572005&amp;post=164&amp;subd=techhangout&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://techhangout.wordpress.com/2010/04/05/job-board-flash-developer-work-from-home/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04625e9362d332cc1dad3efa6a2a4328?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Saj</media:title>
		</media:content>
	</item>
		<item>
		<title>Let&#8217;s Try to be a Good Programmer</title>
		<link>http://techhangout.wordpress.com/2010/02/06/wanna-be-a-good-programmer/</link>
		<comments>http://techhangout.wordpress.com/2010/02/06/wanna-be-a-good-programmer/#comments</comments>
		<pubDate>Sat, 06 Feb 2010 22:23:56 +0000</pubDate>
		<dc:creator>Saj</dc:creator>
				<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://techhangout.wordpress.com/?p=156</guid>
		<description><![CDATA[I have been told that it is simple. Really it is. You got to have fun while programming. If it doesn&#8217;t interest you, this field is not yours. And yes, it applies to any other fields. Learn to go deep. Your learning curve should be full of challenegs and fun. It should be exciting to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=techhangout.wordpress.com&amp;blog=1572005&amp;post=156&amp;subd=techhangout&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have been told that it is simple. Really it is. You got to have fun while programming. If it doesn&#8217;t interest you, this field is not yours. And yes, it applies to any other fields. Learn to go deep. Your learning curve should be full of challenegs and fun. It should be exciting to you like when you play a game, you want to finish strong. When you solve a problem, that&#8217;s not the end. Try to find other ways to solve the same problem. Try to foresee the future. Learn the difference between a solution and a good implementaion. A solution doesn&#8217;t make everything alright. How many ways can a problem be solved? Which one should you implement? Does it affect any phase of the development cycle? Think out of the box.</p>
<p>It is simple.. in a complex way. Go deep and yes, deeper. How far can you dig? Are you having fun while digging? Let&#8217;s try again.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/techhangout.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/techhangout.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/techhangout.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/techhangout.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/techhangout.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/techhangout.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/techhangout.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/techhangout.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/techhangout.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/techhangout.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/techhangout.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/techhangout.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/techhangout.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/techhangout.wordpress.com/156/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=techhangout.wordpress.com&amp;blog=1572005&amp;post=156&amp;subd=techhangout&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://techhangout.wordpress.com/2010/02/06/wanna-be-a-good-programmer/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04625e9362d332cc1dad3efa6a2a4328?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Saj</media:title>
		</media:content>
	</item>
		<item>
		<title>Some Java Features You May Not Know Of</title>
		<link>http://techhangout.wordpress.com/2010/01/01/some-java-features-you-may-not-know-of/</link>
		<comments>http://techhangout.wordpress.com/2010/01/01/some-java-features-you-may-not-know-of/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 23:29:14 +0000</pubDate>
		<dc:creator>Saj</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[Anonymous Class with Initializer Block]]></category>
		<category><![CDATA[Arrays.asList]]></category>
		<category><![CDATA[Comparator]]></category>
		<category><![CDATA[Concurrency Tools]]></category>
		<category><![CDATA[Double-brace Initialization]]></category>
		<category><![CDATA[Dynamic Proxy]]></category>
		<category><![CDATA[Enumeration]]></category>
		<category><![CDATA[feature]]></category>
		<category><![CDATA[finally]]></category>
		<category><![CDATA[getInteger]]></category>
		<category><![CDATA[hidden-feature]]></category>
		<category><![CDATA[Instance Initializers]]></category>
		<category><![CDATA[Labeled Blocks]]></category>
		<category><![CDATA[Local Classes]]></category>
		<category><![CDATA[Object Validation]]></category>
		<category><![CDATA[Scripting API]]></category>
		<category><![CDATA[TreeSet]]></category>
		<category><![CDATA[Tricky]]></category>

		<guid isPermaLink="false">http://techhangout.wordpress.com/?p=144</guid>
		<description><![CDATA[Caution: A long post ahead! Some of the features listed here may appear obvious to some of you. Many programmers I know who are not aware of all these features. If you have read the language specification of Java or you studied for SCJP exam, none of these would appear anything new to you. This [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=techhangout.wordpress.com&amp;blog=1572005&amp;post=144&amp;subd=techhangout&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="color:#ff6600;">Caution</span>: A long post ahead!</p>
<p>Some of the features listed here may appear obvious to some of you. Many programmers I know who are not aware of all these features. If you have read the language specification of Java or you studied for SCJP exam, none of these would appear anything new to you. This is sad that not all of us care to read the language specification or the virtual machine specification of Java. Some of us don’t even have a clear idea on the API.</p>
<h3>Instance Initializers</h3>
<p>Consider the following class:</p>
<p><pre class="brush: java;">

public class SomeClass {

    public SomeClass () {
       System.out.println(&quot;Constructor Invoked&quot;);
    }

    static {
       System.out.println(&quot;Static Initializer Invoked&quot;);
    }

    {
       System.out.println(&quot;Instance Initializer Invoked&quot;);
    }

    public static void main(String... args){
       new SomeClass();
    }
}

</pre></p>
<p>Output:</p>
<p><pre class="brush: java;">

Static Initializer Invoked
Instance Initializer Invoked
Constructor Invoked

</pre></p>
<p>Note that static block gets executed first and it gets executed once. If you try to call SomeClass() several times, only the first call of SomeClass will execute that static block. So, if you call-</p>
<p><pre class="brush: java;">

new SomeClass();
new SomeClass();

</pre></p>
<p>It will print-</p>
<p><pre class="brush: java;">

Static Initializer Invoked
Instance Initializer Invoked
Constructor Invoked
Instance Initializer Invoked
Constructor Invoked

</pre></p>
<p>Static block is pretty good if in the beginning of the class, you want to load some default resources like drivers. Instance initializer is better than using an init() method since it can initialize final fields.</p>
<h3>Anonymous Class with Initializer Block</h3>
<p>This is also called <a href="//www.c2.com/cgi/wiki?DoubleBraceInitialization" target="_blank">Double-brace Initialization</a>. It’s a fancy way of referring to this feature. This feature creates an anonymous inner class and then creates an initializer block inside it, which lets you execute methods from a static context at any time. Note that since it actually creates an anonymous subclass of the object, or in other words, you implicitly hold a reference to the outer object, it can cause some unexpected memory leaks. This example is taken from the link provided. Take a look.</p>
<p>To pass a set to a method:</p>
<p><pre class="brush: java;">

	Set validCodes = new HashSet();

	validCodes.add(&quot;XZ13s&quot;);
	validCodes.add(&quot;AB21/X&quot;);
	validCodes.add(&quot;YYLEX&quot;);
	validCodes.add(&quot;AR2D&quot;);

	removeProductsWithCodeIn(validCodes);

</pre></p>
<p>Or, to initialize a set of constants:</p>
<p><pre class="brush: java;">

private static final Set VALID_CODES = new HashSet();
   static {
      validCodes.add(&quot;XZ13s&quot;);
      validCodes.add(&quot;AB21/X&quot;);
      validCodes.add(&quot;YYLEX&quot;);
      validCodes.add(&quot;AR2D&quot;);
   }

</pre></p>
<p>You can create and initialize a new collection as an expression by using the &#8220;double-brace&#8221; syntax:</p>
<p><pre class="brush: java;">

private static final Set VALID_CODES = new HashSet() {{
    add(&quot;XZ13s&quot;);
    add(&quot;AB21/X&quot;);
    add(&quot;YYLEX&quot;);
    add(&quot;AR2D&quot;);
}};

</pre></p>
<p>Or:</p>
<p><pre class="brush: java;">

removeProductsWithCodeIn(new HashSet() {{
   add(&quot;XZ13s&quot;);
   add(&quot;AB21/X&quot;);
   add(&quot;YYLEX&quot;);
   add(&quot;AR5E&quot;);
}});

</pre></p>
<h3>Labeled Blocks</h3>
<p>This is surprising to me that many Java developers are not aware of <a href="http://java.sun.com/docs/books/jls/second_edition/html/statements.doc.html" target="_blank">this feature</a> or some think it can only only be used with a loop. Take a look at the following snippet-</p>
<p><pre class="brush: java;">

private String setSomehing(final List codesInFile) {
    setCodeDesc: {
       if (codesInFile.contains(&quot;PA&quot;)) {
          break setCodeDesc;
       }
       if (codesInFile.contains(&quot;CA&quot;)) {
          break setCodeDesc;
       }
       return &quot;No Charge&quot;;
    }
    return &quot;Invalid Code&quot;;
}

</pre></p>
<p>Or you can use <em>continue</em>-</p>
<p><pre class="brush: java;">

private void continueLabel(){
   someLabel:
      for (int i = 0; i &lt; 2; i++) {
         for (int j = 0; j &lt; 2; j++) {
            System.out.println(i + &quot; &quot; + j);
            if (i == j) {
               continue someLabel;
            }
         }
      }
}

</pre></p>
<p>If the above method gets executed, it would print-</p>
<p><pre class="brush: java;">

0 0

1 0

1 1

</pre></p>
<p>Note that, you can only continue or break a label from within its scope. You cannot do this-</p>
<p><pre class="brush: java;">

if (i ==0) {
   continue someLabel;
} else {
   //do something
}

someLabel: {
  //do something
}

</pre></p>
<h3>Arrays.asList</h3>
<p><pre class="brush: java;">

   List&lt;Integer&gt; someList = Arrays.asList(12, 14, 18);

</pre></p>
<p>It’s a good combination of generic methods and autoboxing. Note that you cannot extend the size of this list. You cannot do <em>someList.add(22);</em> since the size is backed by the array as it is documented in the <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Arrays.html" target="_blank">API</a>. If you still want to add dynamically, you can wrap it with a constructor like-</p>
<p><pre class="brush: java;">

   List&lt;Integer&gt;  someList = new ArrayList&lt;Integer&gt;(Arrays.asList(12, 14, 18));

</pre></p>
<h3>Concurrency Tools</h3>
<p><a href="http://java.sun.com/docs/books/tutorial/essential/concurrency/" target="_blank">Concurrency tools</a> have been introduced since JDK 1.5 which are cleverly implemented and robust, beyond just locks. You can find those in <a href="http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html" target="_blank">java.util.concurrent</a>. A specifically interesting <a href="http://developerlife.com/tutorials/?p=24" target="_blank">example</a> is the <a href="http://java.sun.com/javase/6/docs/api/java/util/concurrent/atomic/package-summary.html" target="_blank">java.util.concurrent.atomic</a> subpackage that contains thread-safe primitives that implement the <a href="http://www.ibm.com/developerworks/java/library/j-jtp11234/" target="_blank">compare-and-swap</a> operation and can map to actual native hardware-supported versions of these operations. Instead of using synchronized keyword, you can use Lock.lock() and Lock.unlock(). Instead of using wait() and notify() in the critical section use await() and signal() on condition variables. Take a look at the links provided. In DelayQueue, elements are made available after a specified delay. Also java.util.concurrent.TimeUnit is useful when converting between nanoseconds, microseconds, milliseconds and seconds.</p>
<h3>Object Validation</h3>
<p><pre class="brush: java;">

String someString = null;

if( someString != null &amp;&amp; someString instanceof String){
	System.out.println(&quot;true&quot;);
} else {
	System.out.println(&quot;false&quot;);
}

</pre></p>
<p>You can change<em> if( someString != null &amp;&amp; someString instanceof String)</em> to <em>if(someString instanceof String)</em>. The method instanceof checks for null automatically. The above code will print <em>false</em>.</p>
<h3>Dynamic Proxy</h3>
<p><a href="http://java.sun.com/j2se/1.3/docs/guide/reflection/proxy.html" target="_blank">Dynamic Proxy</a> classes allow you to define a new type at runtime that conforms to an interface. It is handy to use a simple Class.forName(SomeClass).newInstance() where the class type is configurable.</p>
<h3>VisualVM</h3>
<p>If you are using JConsole, you might try /bin/jvisualvm.exe in your java installation directory. It is a new tool added to JDK 1.6_07+.</p>
<h3>Enumeration</h3>
<p><a href="http://java.sun.com/j2se/1.5.0/docs/guide/language/enums.html" target="_blank">Enums</a> are so object oriented that you can add methods and constructors to it. You can even use enums to implement an interface. <a href="http://javahowto.blogspot.com/2008/04/java-enum-examples.html" target="_blank"></a></p>
<p><a href="http://javahowto.blogspot.com/2008/04/java-enum-examples.html" target="_blank">Examples</a>:</p>
<p><pre class="brush: java;">
public enum Color {

	WHITE(21), BLACK(22), RED(23), YELLOW(24), BLUE(25);

	private int code;

	private Color(int c) {
		code = c;

	}

	public int getCode() {
		return code;
	}

</pre></p>
<p>Enum can implement any interfaces. All enum types implicitly implements java.io.Serializable, and java.lang.Comparable.</p>
<p><pre class="brush: java;">

public enum Color implements Runnable {

	WHITE, BLACK, RED, YELLOW, BLUE;

	public void run() {
		System.out.println(&quot;name()=&quot; + name() +
					&quot;, toString()=&quot; + toString());
	}

	public static void main(String... args){
        for(Color c : Color.values()) {
               c.run();
        }
	}
}

</pre></p>
<h3>..and some stuff (not features) you may want to know about</h3>
<h3>The <em>finally </em>Block</h3>
<p>As I mentioned in my earlier <a href="http://techhangout.com/2009/12/02/tricky-try-catch-finally-of-java/" target="_blank">post</a>, you should not use return statement in a <em>finally </em>block-</p>
<p><pre class="brush: java;">

public static void someMethod() {
    try {
         throw new RuntimeException();
    } finally {
         return;
    }
}

</pre></p>
<p>This <em>RunTimeException </em>will be lost because of the return statement in finally block.</p>
<h3>Local Classes</h3>
<p>A <a href="http://java.sun.com/docs/books/jls/second_edition/html/statements.doc.html#247766" target="_blank">local class</a> is a nested class that is not a member of any class and that has a name.</p>
<p><pre class="brush: java;">

public class ClassInsideMethod {
	public String someMethod(){
		class Person {
			private String getPerson(){
				return &quot;John&quot;;
			}
		}
		return new Person().getPerson();
	}

	public static void main(String... args){
		System.out.println(new ClassInsideMethod().someMethod());
	}
}

</pre></p>
<h3>Comparator and TreeSet</h3>
<p>Comparator can change the Set semantics-</p>
<p><pre class="brush: java;">

import java.util.*;

public class ComparatorSet {

	public static void main(String[] args) {
		Set set = new TreeSet(new ChangeSemantics());
		set.add(&quot;Apple&quot;);
		set.add(&quot;Bannana&quot;);
		System.out.println(set);
	}

	public static class ChangeSemantics implements Comparator {
		public int compare(String left, String right) {
			return 0;
		}
	}
}

</pre></p>
<p>This will print- <em>[Apple]</em> Try changing the return value to 1 or -1 and see the result if you are confused. Note that TreeSet relies on Comparator to define equality. For instance, if you add <em>System.out.println(set.contains(&#8220;Orange&#8221;));</em> in the main method, it will print <em>true </em>since you are returning 0 in <em>compare()</em>. If you return 1, it will print <em>false </em>obviously.</p>
<h3>Integer.getInteger</h3>
<p>The <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Integer.html" target="_blank">getInteger </a>method confuses some developers. I ask this often to applicants during interviews. What would the following statement print-</p>
<p><pre class="brush: java;">

System.err.println(Integer.getInteger(&quot;500&quot;));

</pre></p>
<p>And no, it&#8217;s not gonna print <em>500</em>! Check the API link provided.</p>
<h3>Tricky</h3>
<p>And this one (Taken from Joshua Bloch&#8217;s Effective Java), what would happen when the following snippet gets executed? I even get answer like &#8211; internet explorer would get launched?</p>
<p><pre class="brush: java;">

System.out.print(&quot;iexplore:&quot;);
http://www.techhangout.com;
System.out.println(&quot;:maximize&quot;);

</pre></p>
<p>Highlight the text below to read the explanation if you haven&#8217;t figured it out.</p>
<p><span style="color:#ffffff;">JVM doesn’t see that as a url. It sees the colon after http which makes it think that it’s a <em>label block</em> followed by a comment because of //.</span></p>
<h3>The Scripting API</h3>
<p>With the Java <a href="http://java.sun.com/javase/6/docs/api/javax/script/package-summary.html" target="_blank">Scripting API</a>, it is possible to write customizable/extendable applications in the Java language and leave the customization scripting language choice to the end user.</p>
<p><pre class="brush: java;">

System.out.println(new ScriptEngineManager().getEngineByName(&quot;JavaScript&quot;).eval(&quot;  5 + 5&quot;));

</pre></p>
<p>Note that the space before 5 was intentionally placed as it behaves like <a href="http://en.wikipedia.org/wiki/JavaScript" target="_blank">JavaScript</a>. It will print 10.0.</p>
<p>I wanted to include a lot more but this is really getting too long. Enjoy coding in Java!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/techhangout.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/techhangout.wordpress.com/144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/techhangout.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/techhangout.wordpress.com/144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/techhangout.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/techhangout.wordpress.com/144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/techhangout.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/techhangout.wordpress.com/144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/techhangout.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/techhangout.wordpress.com/144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/techhangout.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/techhangout.wordpress.com/144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/techhangout.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/techhangout.wordpress.com/144/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=techhangout.wordpress.com&amp;blog=1572005&amp;post=144&amp;subd=techhangout&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://techhangout.wordpress.com/2010/01/01/some-java-features-you-may-not-know-of/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04625e9362d332cc1dad3efa6a2a4328?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Saj</media:title>
		</media:content>
	</item>
		<item>
		<title>System Design &#8211; Can I Borrow a Middle Name?</title>
		<link>http://techhangout.wordpress.com/2009/12/22/system-design-can-i-borrorw-a-middle-name/</link>
		<comments>http://techhangout.wordpress.com/2009/12/22/system-design-can-i-borrorw-a-middle-name/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 07:23:40 +0000</pubDate>
		<dc:creator>Saj</dc:creator>
				<category><![CDATA[software-design]]></category>
		<category><![CDATA[web-development]]></category>
		<category><![CDATA[system-design]]></category>

		<guid isPermaLink="false">http://techhangout.wordpress.com/?p=133</guid>
		<description><![CDATA[Last week I applied for an EON Cyber Account (a bank account for online transactions only) with a local Union Bank branch here in the Philippines. I got a call from them just a while ago saying that they cannot proceed with my application because their online system requires me to have a middle name! [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=techhangout.wordpress.com&amp;blog=1572005&amp;post=133&amp;subd=techhangout&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Last week I applied for an <a href="http://www.unionbankph.com/index.php?option=com_content&amp;view=article&amp;id=1035&amp;Itemid=245" target="_blank">EON</a> Cyber Account (a bank account for online transactions only) with a local <a href="http://www.unionbankph.com" target="_blank">Union Bank</a> branch here in the Philippines. I got a call from them just a while ago saying that they cannot proceed with my application because their online system requires me to have a middle name! Yeah, wtf! I asked them if I could use any letter as my middle name since I don&#8217;t have one. They contacted their IT support and the main branch which confirmed- it&#8217;s simply not possible.</p>
<p>I needed this account quite badly as my other credit card applications were denied because of the fact that I&#8217;m a foreigner. That was frustrating and I was desperate.  I made several calls to find someone in Union Bank who I could ask &#8211; who designed your effing system?</p>
<p>Geez! Get a middle name!!!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/techhangout.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/techhangout.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/techhangout.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/techhangout.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/techhangout.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/techhangout.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/techhangout.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/techhangout.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/techhangout.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/techhangout.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/techhangout.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/techhangout.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/techhangout.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/techhangout.wordpress.com/133/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=techhangout.wordpress.com&amp;blog=1572005&amp;post=133&amp;subd=techhangout&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://techhangout.wordpress.com/2009/12/22/system-design-can-i-borrorw-a-middle-name/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04625e9362d332cc1dad3efa6a2a4328?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Saj</media:title>
		</media:content>
	</item>
		<item>
		<title>When You Should NOT Follow your Role Models</title>
		<link>http://techhangout.wordpress.com/2009/12/16/when-you-should-not-follow-your-role-models/</link>
		<comments>http://techhangout.wordpress.com/2009/12/16/when-you-should-not-follow-your-role-models/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 19:33:47 +0000</pubDate>
		<dc:creator>Saj</dc:creator>
				<category><![CDATA[data-backups]]></category>
		<category><![CDATA[codinghorror]]></category>
		<category><![CDATA[data backup]]></category>
		<category><![CDATA[jeffatwood]]></category>

		<guid isPermaLink="false">http://techhangout.wordpress.com/?p=124</guid>
		<description><![CDATA[    Jeff Atwood is one of the most popular bloggers in Software Development community today. He has been blogging since 2004. If you are a developer, you might have heard of him. It&#8217;s truly a sad thing that the server to which his blog Coding Horror is hosted on recently suffered a catastrophic data [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=techhangout.wordpress.com&amp;blog=1572005&amp;post=124&amp;subd=techhangout&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p> </p>
<p><div id="attachment_170" class="wp-caption alignleft" style="width: 146px"><a href="http://techhangout.files.wordpress.com/2009/12/jeffatwood_techhangout.jpg"><img class="size-full wp-image-170" title="JeffAtwood_techhangout" src="http://techhangout.files.wordpress.com/2009/12/jeffatwood_techhangout.jpg?w=136&#038;h=120" alt="" width="136" height="120" /></a><p class="wp-caption-text">Jeff Atwood</p></div>
<p> </p>
<p>Jeff Atwood is one of the most popular bloggers in Software Development community today. He has been blogging since 2004. If you are a developer, you might have heard of him. It&#8217;s truly a sad thing that the server to which his blog <a href="http://www.codinghorror.com/blog/" target="_blank">Coding Horror</a> is hosted on recently suffered a catastrophic data loss.</p>
<p>But that is not the whole <a href="http://www.codinghorror.com/blog/archives/001315.html" target="_blank">story</a>! The data was never backed up by the hosting provider. Even worse, Jeff doesn&#8217;t have backups of his own blog. Yes, you read it right! Did no one ever tell you how important it is to back up your data? Well, Jeff once did &#8211; <a href="http://www.codinghorror.com/blog/archives/001045.html" target="_blank">here</a>. He should have just subscribed to his own rss feed and store the data?</p>
<p>It&#8217;s like you are very concern about security when registering to a website, but you use a plain word as your password! For the love of God, haven&#8217;t you at least heard of <a href="http://www.codinghorror.com/blog/archives/001206.html" target="_blank">Dictionary Attacks</a>? Did Jeff ever get his password hacked? O yeah, he certainly <a href="http://www.codinghorror.com/blog/archives/001263.html" target="_blank">did</a>!</p>
<p>So, do you think some of your role models are just saying stuff to sound smart? Well, some do.</p>
<p>pi.es. I have learned many things from Coding Horror.. and it&#8217;s quite frustrating that hundreds of thousands treat him as a solid programming guy who does what he says!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/techhangout.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/techhangout.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/techhangout.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/techhangout.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/techhangout.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/techhangout.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/techhangout.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/techhangout.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/techhangout.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/techhangout.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/techhangout.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/techhangout.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/techhangout.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/techhangout.wordpress.com/124/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=techhangout.wordpress.com&amp;blog=1572005&amp;post=124&amp;subd=techhangout&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://techhangout.wordpress.com/2009/12/16/when-you-should-not-follow-your-role-models/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04625e9362d332cc1dad3efa6a2a4328?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Saj</media:title>
		</media:content>

		<media:content url="http://techhangout.files.wordpress.com/2009/12/jeffatwood_techhangout.jpg" medium="image">
			<media:title type="html">JeffAtwood_techhangout</media:title>
		</media:content>
	</item>
		<item>
		<title>Tricky try..catch..finally of Java</title>
		<link>http://techhangout.wordpress.com/2009/12/02/tricky-try-catch-finally-of-java/</link>
		<comments>http://techhangout.wordpress.com/2009/12/02/tricky-try-catch-finally-of-java/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 23:13:39 +0000</pubDate>
		<dc:creator>Saj</dc:creator>
				<category><![CDATA[exception]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[catch]]></category>
		<category><![CDATA[finally]]></category>
		<category><![CDATA[try]]></category>

		<guid isPermaLink="false">http://techhangout.wordpress.com/?p=111</guid>
		<description><![CDATA[In Java, we all know that the finally block always gets executed unless System.exit() is called prior to that or if the JVM crashes first. So, let&#8217;s take a look in the following methods and figure out what would be the result after their executions- Highlight the white space below to see the result. Output: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=techhangout.wordpress.com&amp;blog=1572005&amp;post=111&amp;subd=techhangout&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In Java, we all know that the <em>finally</em> block always gets executed unless <em>System.exit()</em> is called prior to that or if the JVM crashes first. So, let&#8217;s take a look in the following methods and figure out what would be the result after their executions-</p>
<p><pre class="brush: java;">
private boolean testTryCatchFinally(){
 String value = null;
 try{
 // Throws null pointer exception
 int s = value.length();
 System.out.println(&quot;null&quot;);
 } finally {
 System.out.println(&quot;finally&quot;);
 return false;
 }
}
</pre></pre>
<p>Highlight the white space below to see the result.<br />
<span style="color:#ffffff;">Output:<br />
<span style="color:#ffffff;">finally<br />
The value w</span>ill be returned: false<br />
Since a NULL doesn't have a length, we gonna get a NullPointerException. Hence, jvm will proceed with the finally block.</span></p>
<p>Here's another one with a slight modification-</p>
<p><pre class="brush: java;">
private boolean testTryCatchFinally(){
 String value = null;
 try{
 // Throws null pointer exception
 int s = value.length();
 } catch (NullPointerException nullEx){
 return true;
 } finally {
 System.out.println(&quot;finally&quot;);
 }
 return false;
}
</pre></p>
<p>Highlight the white space below to see the result.<br />
<span style="color:#ffffff;"><span style="color:#ffffff;">Output:<br />
finally<br />
The value will be returned: true<br />
Just like</span> before we'll get a NullPointerException. However, here we caught the exception, so catch block is supposed to get executed first and then finally block. But catch block has a return statement, jvm will see that and will proceed with the finally first. When it is done with finally, it will execute the return statement of catch block.</span></p>
<p>Now, here's the tricky one. What will be returned if the following method gets executed?</p>
<p><pre class="brush: java;">
private boolean testTryCatchFinally(){
 String value = null;
 try{
 // Throws null pointer exception
 int s = value.length();
 } catch (NullPointerException nullEx){
 System.out.println(&quot;catch&quot;);
 return true;
 } finally {
 System.out.println(&quot;finally&quot;);
 return false;
 }
}
</pre></p>
<p>Confused? It would print catch and finally both and would return <em>false</em>. Using <em>return </em>statement in a <em>finally</em> block is a bad practice.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/techhangout.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/techhangout.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/techhangout.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/techhangout.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/techhangout.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/techhangout.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/techhangout.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/techhangout.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/techhangout.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/techhangout.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/techhangout.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/techhangout.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/techhangout.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/techhangout.wordpress.com/111/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=techhangout.wordpress.com&amp;blog=1572005&amp;post=111&amp;subd=techhangout&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://techhangout.wordpress.com/2009/12/02/tricky-try-catch-finally-of-java/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04625e9362d332cc1dad3efa6a2a4328?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Saj</media:title>
		</media:content>
	</item>
		<item>
		<title>How Can “while (i == i) ;” be a Non-infinite Loop in Java?</title>
		<link>http://techhangout.wordpress.com/2009/11/27/how-can-%e2%80%9cwhile-i-i-%e2%80%9d-be-a-non-infinite-loop-in-java/</link>
		<comments>http://techhangout.wordpress.com/2009/11/27/how-can-%e2%80%9cwhile-i-i-%e2%80%9d-be-a-non-infinite-loop-in-java/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 02:18:12 +0000</pubDate>
		<dc:creator>Saj</dc:creator>
				<category><![CDATA[interview]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://techhangout.wordpress.com/?p=91</guid>
		<description><![CDATA[Before you see the answer, try to think for a second.  Threading is not an  issue here since the program is using only one thread. The answer is below in white text. Highlight to read. double i = Double.NaN; while(i == i) ; System.out.println("Not Infinite!"); NaN stands for Not a Number like in JavaScript. Mathematically [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=techhangout.wordpress.com&amp;blog=1572005&amp;post=91&amp;subd=techhangout&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="color:#000000;">Before you see the answer, try to think for a second.  Threading is not an  issue here since the program is using only one thread.</span></p>
<p><span style="color:#000000;">The answer is below in white text. Highlight to read.</span></p>
<pre><span style="color:#ffffff;"><code>double i = Double.NaN;
</code><code>while(i == i) ;</code>
<code>System.out.println("Not Infinite!");</code>

<code>NaN stands for Not a Number like in JavaScript.
Mathematically speaking, you cannot equate something
that is not a number with another.
</code><span style="color:#ffffff;">Read the<span style="color:#ffffff;"> <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Double.html">API</a>.</span></span></span></pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/techhangout.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/techhangout.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/techhangout.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/techhangout.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/techhangout.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/techhangout.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/techhangout.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/techhangout.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/techhangout.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/techhangout.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/techhangout.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/techhangout.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/techhangout.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/techhangout.wordpress.com/91/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=techhangout.wordpress.com&amp;blog=1572005&amp;post=91&amp;subd=techhangout&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://techhangout.wordpress.com/2009/11/27/how-can-%e2%80%9cwhile-i-i-%e2%80%9d-be-a-non-infinite-loop-in-java/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04625e9362d332cc1dad3efa6a2a4328?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Saj</media:title>
		</media:content>
	</item>
		<item>
		<title>Premature Optimization is the Root of All Evil</title>
		<link>http://techhangout.wordpress.com/2009/11/12/premature-optimization-is-the-root-of-all-evil/</link>
		<comments>http://techhangout.wordpress.com/2009/11/12/premature-optimization-is-the-root-of-all-evil/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 14:48:28 +0000</pubDate>
		<dc:creator>Saj</dc:creator>
				<category><![CDATA[optimization]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[optimization software-engineering sdlc]]></category>

		<guid isPermaLink="false">http://techhangout.wordpress.com/?p=65</guid>
		<description><![CDATA[In Donald Knuth&#8216;s paper &#8220;Structured Programming With Go To Statements&#8220;, he wrote: &#8220;Programmers waste enormous amounts of time thinking about, or worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered. We should forget about small efficiencies, say [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=techhangout.wordpress.com&amp;blog=1572005&amp;post=65&amp;subd=techhangout&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://en.wikipedia.org/wiki/Donald_Knuth">Donald Knuth</a>&#8216;s paper &#8220;<a href="http://pplab.snu.ac.kr/courses/adv_pl05/papers/p261-knuth.pdf">Structured Programming With Go To Statements</a>&#8220;, he wrote: &#8220;Programmers waste enormous amounts of time thinking about, or worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered. We <em>should</em> forget about small efficiencies, say about 97% of the time: <strong>premature optimization is the root of all evil.</strong>&#8220;</p>
<p>Have you seen a similar comment in any source code-</p>
<p><span style="color:#993300;"><code>// </code><br />
<code>// Dear maintainer:</code><br />
<code>// </code><br />
<code>// Once you are done trying to 'optimize' this routine,</code><br />
<code>// and have realized what a terrible mistake that was,</code><br />
<code>// please increment the following counter as a warning</code><br />
<code>// to the next guy:</code><br />
<code>// </code><br />
<code>// total_hours_wasted_here = 16</code><br />
<code>//</code></span></p>
<p>I am not gonna write anything new on this topic as you can google it and find tons of research papers explaining the reason behind it.</p>
<p>Things to consider:</p>
<p>You might wanna right a cute algorithm, compress hundreds of lines of code into only a hundred lines, do you think it will be easy to understand, easy to debug, easy to maintain?</p>
<p>Do you think the optimization matters in the particular area of your program or you just want to make it look smart? If you are not sure, don&#8217;t optimize. </p>
<p>Do you understand how memory and cpu work? If not, then don&#8217;t try to optimize a routine that deals with memory and cpu management unless it&#8217;s &#8220;obvious&#8221;.</p>
<p>You sure your optimization would not make the development more expensive? If not, then don&#8217;t.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/techhangout.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/techhangout.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/techhangout.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/techhangout.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/techhangout.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/techhangout.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/techhangout.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/techhangout.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/techhangout.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/techhangout.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/techhangout.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/techhangout.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/techhangout.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/techhangout.wordpress.com/65/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=techhangout.wordpress.com&amp;blog=1572005&amp;post=65&amp;subd=techhangout&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://techhangout.wordpress.com/2009/11/12/premature-optimization-is-the-root-of-all-evil/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04625e9362d332cc1dad3efa6a2a4328?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Saj</media:title>
		</media:content>
	</item>
	</channel>
</rss>
