<?xml version="1.0" encoding="UTF-8"?><rss version="2.0">
<channel>
<title>final</title>
<link>http://www.computersight.com/tags/final</link>
<description>New posts about final</description>
<item>
<title>Java Final Keyword</title>
<link>http://www.computersight.com/Programming/Java/Java-Final-Keyword.219303</link>
<description>
<![CDATA[<h3>Final keyword</h3>
<p>A simple tutorial on the basics of java &amp;ldquo;final&amp;rdquo; keyword. This is very useful for java learners.</p>
<p>The final keyword is used to declare the final classes, final methods and final variables.</p>
<h3>final class:</h3>
<p>If the class is declared as a final, you can not extend this class. The purpose of this, nobody can change your functionality with overriding the methods.</p>
<p>We can avoid the sub-classing using final keyword.  You can avoid the sub-classing using private constructor also, but you can not create the Instance out-side of that class.</p>
<p>Declaring the final class:</p>
<p>public <strong>final</strong> classname{</p>
<p>}</p>
<p>There are some final classes in the Java also.  Some of them are:</p>
<p>String <br /><br /> StringBuilder</p>
<p>Integer</p>
<p><strong>final</strong> method:</p>
<p>If the method is declared as final, you can not override this method. The purpose of this, if you extend the class also you can not override the final methods.</p>
<p>Declaring the final methods:</p>
<p>Public <strong>final</strong> return-type methodname() {</p>
<p>}</p>
<p><strong>final</strong> variable:</p>
<p>If the variable is declared as final, you can not change the value of that variable. Whenever you need the constant values like pie, you can use the final variables.</p>
<p>Declaring the final variable:</p>
<p>public <strong>final</strong> float pie = 3.44f;</p>
<p>The pie variable value is constant, because of it's final variable. We can not change the value of pie variable once it is initialized.</p><a href="http://www.pheedo.com/click.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FProgramming%2FJava%2FJava-Final-Keyword.219303"><img src="http://www.pheedo.com/img.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FProgramming%2FJava%2FJava-Final-Keyword.219303" border="0"/></a>]]></description>
<pubDate>Thu, 21 Aug 2008 04:21:45 PST</pubDate></item>
</channel>
</rss>
