<?xml version="1.0" encoding="UTF-8" standalone="no"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:gd="http://schemas.google.com/g/2005" xmlns:georss="http://www.georss.org/georss" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-5732959929032431013</atom:id><lastBuildDate>Fri, 08 Nov 2024 15:24:06 +0000</lastBuildDate><category>Java</category><category>J2ee</category><category>JavaScript</category><category>Advanced Java</category><category>Core Java</category><category>js</category><category>JSP</category><category>web service</category><category>HTML</category><category>Misc</category><category>distibuted computing</category><category>rpc model</category><category>services</category><category>JSTL</category><category>Java Faq</category><category>java script</category><category>xml</category><category>CSS</category><category>Implicit objects in jsp</category><category>JQuery</category><category>Logging</category><category>Spring</category><category>Web Site Security</category><category>Webservices</category><category>final in java</category><category>Ajax</category><category>Captcha</category><category>DOJO</category><category>Internationalization</category><category>Java Security</category><category>Log4j</category><category>Servlets</category><category>asynchronously js</category><category>csrf</category><category>i18n</category><category>java keywords</category><category>sax</category><category>servlet</category><category>== vs ===</category><category>AOP</category><category>Ant Script</category><category>Apache Ant</category><category>Blogger</category><category>Build Script</category><category>Changes in XHTML from HTML</category><category>Cloud Computing</category><category>Code Snippets</category><category>Difference Between Internationalization and Localization</category><category>Difference Between i18n and l10n</category><category>Difference Between if(null == myVariable) and if(myVariable == null)</category><category>Environment variables</category><category>Equality Operators</category><category>Equality Operators in Javascript</category><category>Firebug</category><category>Firefox</category><category>Generics</category><category>Generics in Java</category><category>GlassFish</category><category>Google App Engine</category><category>HTML5</category><category>Hibernate</category><category>Init Parameters</category><category>Integrating P4 (Perforce) to IntelliJ Idea</category><category>IntelliJ Idea</category><category>Introduction to JQuery</category><category>JAX-RS</category><category>JDK Logging</category><category>JRuby</category><category>JSON</category><category>JSP Initialization Parameters</category><category>JSTL Core Tags</category><category>JSTL Formatting Tags</category><category>JSTL SQL Tags</category><category>JSTL Tags</category><category>Java  Internationalization</category><category>Java Authentication</category><category>Java Classpath</category><category>Java Path</category><category>JavaScript Optimization Tips</category><category>JavaScript Performance Tuning Tool</category><category>Junit</category><category>Junit example</category><category>Known Issues with AJAX</category><category>Localization</category><category>LogDigger</category><category>MVC Architecture</category><category>Modified Equality Operators in Javascript</category><category>New Release</category><category>OOPS concepts</category><category>Object oriented programming</category><category>Object-oriented programming</category><category>Objective C</category><category>OpenID</category><category>Overview of XHTML</category><category>PHP</category><category>Perforce</category><category>Performance Tuning</category><category>Ruby</category><category>Servlets vs JSP</category><category>Software</category><category>Understanding AJAX</category><category>What is XHTML</category><category>XHTML</category><category>XML Schema</category><category>XSD</category><category>XSS</category><category>difference between null == and == null</category><category>difference between while and do while loop</category><category>do while loop</category><category>dom</category><category>final</category><category>final classes</category><category>final filesd</category><category>final methods</category><category>final veriables</category><category>java 5</category><category>java 5 features</category><category>java examples</category><category>java i18n</category><category>java null check</category><category>java server faces</category><category>java servlet filters</category><category>jsf</category><category>jsf example</category><category>l10n</category><category>model view controller atchitecture</category><category>mvc design pattern</category><category>mvc1</category><category>mvc2</category><category>null</category><category>null check</category><category>null vs undefined in javascript</category><category>oops</category><category>overview of filters</category><category>scope</category><category>scope in java script</category><category>scope in js</category><category>servlet filters</category><category>simple jsf</category><category>static</category><category>static classes</category><category>static in java</category><category>static veriables</category><category>steps for Java  Internationalization</category><category>undefined</category><category>undefined vs null</category><category>understanding Junit</category><category>understanding static in java</category><category>web application localization</category><category>while loop</category><category>xmlhttpobject</category><title>Java Tech Page 4u</title><description></description><link>http://javatechpage.blogspot.com/</link><managingEditor>noreply@blogger.com (GS)</managingEditor><generator>Blogger</generator><openSearch:totalResults>79</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>10</openSearch:itemsPerPage><xhtml:meta content="noindex" name="robots" xmlns:xhtml="http://www.w3.org/1999/xhtml"/><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5732959929032431013.post-4558341184730171713</guid><pubDate>Fri, 02 Dec 2011 01:35:00 +0000</pubDate><atom:updated>2011-12-01T17:35:45.895-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">HTML</category><category domain="http://www.blogger.com/atom/ns#">HTML5</category><title>HTML 5 Media Elements With Example</title><description>The new HTML5 media elements are ..&lt;br /&gt;&lt;br /&gt;&amp;lt;audio&gt; : For audio content, sounds, music or other audio streams&lt;br /&gt;&amp;lt;video&gt; : For video content, such as a movie clip or other video streams&lt;br /&gt;&amp;lt;source&gt; : For media resources for media elements, defined inside video or audio elements&lt;br /&gt;&amp;lt;embed&gt; : For embedded content, such as a plug-in&lt;br /&gt;&amp;lt;track&gt; : For text tracks used in media players&lt;br /&gt;&lt;br /&gt;Audio example :&lt;br /&gt;&lt;div style="border: solid 1px #A9B7C6;background:#1AFA1F"&gt;&lt;br /&gt;&amp;lt;audio controls="controls"&gt;&lt;br /&gt;  &amp;lt;source src="song.ogg" type="audio/ogg" /&gt;&lt;br /&gt;&amp;lt;/audio&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Video example :&lt;br /&gt;&lt;div style="border: solid 1px #A9B7C6;background:#1AFA1F"&gt;&lt;br /&gt;&amp;lt;video width="320" height="240" controls="controls"&gt;&lt;br /&gt;  &amp;lt;source src="movie.mp4" type="video/mp4" /&gt;&lt;br /&gt;&amp;lt;/video&gt;&lt;br /&gt;&lt;/div&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
amazon_ad_tag = "jatepa4u-20"; amazon_ad_width = "728"; amazon_ad_height = "90";//--&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="http://www.assoc-amazon.com/s/ads.js"&gt;&lt;/script&gt;&lt;/div&gt;</description><link>http://javatechpage.blogspot.com/2011/12/html-5-media-elements-with-example.html</link><author>noreply@blogger.com (GS)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5732959929032431013.post-2198262824385819272</guid><pubDate>Thu, 24 Nov 2011 17:07:00 +0000</pubDate><atom:updated>2011-11-24T09:07:58.623-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">CSS</category><category domain="http://www.blogger.com/atom/ns#">HTML</category><title>Linking (including) an external CSS (style sheet) to a HTML page</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;An external style sheet can be linked to the page with a &amp;lt;link&amp;gt; tag. &lt;br /&gt;
&lt;br /&gt;
Example link tag which includes an external style sheet is as follows..&lt;br /&gt;
&lt;br /&gt;
&lt;div style="border: 1px solid rgb(0, 0, 0);"&gt;&amp;lt;link rel="stylesheet" type="text/css" href="xyz.css" /&amp;gt;&lt;/div&gt;&lt;br /&gt;
The advantage of doing this is that the same style sheet can be used in every page on your site. And the entire site's styling can be managed by changing just this one file.&lt;br /&gt;
&lt;br /&gt;
When the CSS is defined inside the html page, the css classes can be declared with in the &amp;lt;style&amp;gt; tags, but we do not put &amp;lt;style&amp;gt; tags inside an external style sheet.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
amazon_ad_tag = "jatepa4u-20"; amazon_ad_width = "728"; amazon_ad_height = "90";//--&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="http://www.assoc-amazon.com/s/ads.js"&gt;&lt;/script&gt;&lt;/div&gt;</description><link>http://javatechpage.blogspot.com/2011/11/linking-including-external-css-style.html</link><author>noreply@blogger.com (GS)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5732959929032431013.post-3421880959556273259</guid><pubDate>Thu, 24 Nov 2011 16:57:00 +0000</pubDate><atom:updated>2011-11-24T08:57:59.179-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">CSS</category><category domain="http://www.blogger.com/atom/ns#">HTML</category><title>What is CSS? Where is CSS Used? and an example HTML that uses CSS</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;CSS is nothing but Cascading Style Sheets, these are used to separate the content from design of the HTML page, so that in future if we want to change the design and layout of the HTML page, without disturbing the content, it will become any easy job. That is we can change the layout / design by simply modifying the CSS.&lt;br /&gt;
&lt;br /&gt;
The CSS can be declared with in the html file or in a separate CSS file.&lt;br /&gt;
&lt;br /&gt;
The structure of the simple CSS is as follows,&lt;br /&gt;
&lt;br /&gt;
&lt;div style="border: 1px solid rgb(0, 0, 0);"&gt;.leftcol&lt;br /&gt;
{&lt;br /&gt;
float: left;&lt;br /&gt;
width: 33%;&lt;br /&gt;
background:#908800;&lt;br /&gt;
}&lt;br /&gt;
.middlecol&lt;br /&gt;
{&lt;br /&gt;
float: left;&lt;br /&gt;
width: 34%;&lt;br /&gt;
background:#effefe;&lt;br /&gt;
}&lt;br /&gt;
.rightcol&lt;br /&gt;
{&lt;br /&gt;
float:left;&lt;br /&gt;
width: 33%;&lt;br /&gt;
background:#dddd11;&lt;br /&gt;
}&lt;/div&gt;&lt;br /&gt;
In the above example the "leftcol","middlecol","rightcol" are the css class names, which defines its own styling, these classes need to be applied on the HTML elements to see these styling effects.&lt;br /&gt;
&lt;br /&gt;
simple html that uses the above declared css class&lt;br /&gt;
&lt;br /&gt;
&lt;div style="border: 1px solid rgb(0, 0, 0);"&gt;&amp;lt;html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;style type=​"text/​css"&amp;gt;&lt;br /&gt;
.leftcol&lt;br /&gt;
{&lt;br /&gt;
float: left;&lt;br /&gt;
width: 33%;&lt;br /&gt;
background:#908800;&lt;br /&gt;
}&lt;br /&gt;
.middlecol&lt;br /&gt;
{&lt;br /&gt;
float: left;&lt;br /&gt;
width: 34%;&lt;br /&gt;
background:#effefe;&lt;br /&gt;
}&lt;br /&gt;
.rightcol&lt;br /&gt;
{&lt;br /&gt;
float:left;&lt;br /&gt;
width: 33%;&lt;br /&gt;
background:#dddd11;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/style&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class="leftcol"&amp;gt;this is a left div ...&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class="middlecol"&amp;gt;this is a middle div ...&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class="rightcol"&amp;gt;this is a right div ...&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
amazon_ad_tag = "jatepa4u-20"; amazon_ad_width = "728"; amazon_ad_height = "90";//--&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="http://www.assoc-amazon.com/s/ads.js"&gt;&lt;/script&gt;&lt;/div&gt;</description><link>http://javatechpage.blogspot.com/2011/11/what-is-css-where-is-css-used-and.html</link><author>noreply@blogger.com (GS)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5732959929032431013.post-9030586738361722224</guid><pubDate>Thu, 24 Nov 2011 16:53:00 +0000</pubDate><atom:updated>2011-11-24T08:55:29.538-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">DOJO</category><category domain="http://www.blogger.com/atom/ns#">JavaScript</category><category domain="http://www.blogger.com/atom/ns#">JQuery</category><title>What is the difference between Dojo and jQuery</title><description>&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, Arial, default; font-size: 13px; line-height: 17px; "&gt;jQuery is a JavaScript Library that simplifies HTML document traversing(DOM &lt;span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, Arial, default; font-size: 13px; line-height: 17px; "&gt;manipulation&lt;/span&gt;), event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, Arial, default; font-size: 13px; line-height: 17px; "&gt;Dojo is a more comprehensive toolkit that offers the above features, but also includes many other pieces that facilitate building rich web applications&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
amazon_ad_tag = "jatepa4u-20"; amazon_ad_width = "728"; amazon_ad_height = "90";//--&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="http://www.assoc-amazon.com/s/ads.js"&gt;&lt;/script&gt;&lt;/div&gt;</description><link>http://javatechpage.blogspot.com/2011/11/what-is-difference-between-dojo-and.html</link><author>noreply@blogger.com (GS)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5732959929032431013.post-1687854721168498256</guid><pubDate>Mon, 21 Nov 2011 14:37:00 +0000</pubDate><atom:updated>2011-11-21T06:37:06.216-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">sax</category><category domain="http://www.blogger.com/atom/ns#">xml</category><title>Simple SAX parser example (count number of elements in an xml file)</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;b&gt;Example Xml File :&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?xml version = "1.0" ?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Employees&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Employee&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Emp_Id&amp;gt; 1 &amp;lt;/Emp_Id&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Emp_Name&amp;gt; Bob &amp;lt;/Emp_Name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Emp_E-mail&amp;gt; bob@hotmail.com &amp;lt;/Emp_E-mail&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Employee&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Employee&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Emp_Id&amp;gt; 2 &amp;lt;/Emp_Id&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Emp_Name&amp;gt; Nick &amp;lt;/Emp_Name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Emp_E-mail&amp;gt; nick@yahoo.com &amp;lt;/Emp_E-mail&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Employee&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Employee&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Emp_Id&amp;gt; 3 &amp;lt;/Emp_Id&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Emp_Name&amp;gt; John &amp;lt;/Emp_Name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Emp_E-mail&amp;gt; john@gmail.com &amp;lt;/Emp_E-mail&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Employee&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Employees&amp;gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;b&gt;Java code to parse the above xml file and provides the elements count&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;import javax.xml.parsers.*;&lt;br /&gt;
import org.xml.sax.*;&lt;br /&gt;
import org.xml.sax.helpers.*;&lt;br /&gt;
import java.io.*;&lt;br /&gt;
&lt;br /&gt;
public class ElementCount{ &lt;br /&gt;
int startTag = 0;&lt;br /&gt;
public static String ele;&lt;br /&gt;
public static void main(String args[])throws IOException {&lt;br /&gt;
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));&lt;br /&gt;
System.out.print("Enter XML file name:");&lt;br /&gt;
String xmlFile = bf.readLine();&lt;br /&gt;
File file = new File(xmlFile);&lt;br /&gt;
if (file.exists()){&lt;br /&gt;
System.out.print("Enter tag name for which the count should be calculated:");&lt;br /&gt;
ele = bf.readLine();&lt;br /&gt;
ElementCount tagCount = new ElementCount(xmlFile);&lt;br /&gt;
}&lt;br /&gt;
else{&lt;br /&gt;
System.out.println("File not found!");&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
public ElementCount(String str){&lt;br /&gt;
try{&lt;br /&gt;
SAXParserFactory parserFact = SAXParserFactory.newInstance();&lt;br /&gt;
SAXParser parser = parserFact.newSAXParser();&lt;br /&gt;
DefaultHandler dHandler = new DefaultHandler(){&lt;br /&gt;
public void startElement(String uri, String name, String element,&lt;br /&gt;
Attributes atri)throws SAXException{&lt;br /&gt;
if (element.equals(ele)){&lt;br /&gt;
startTag++;&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
public void endDocument(){&lt;br /&gt;
System.out.println("Total elements: " + startTag);&lt;br /&gt;
}&lt;br /&gt;
};&lt;br /&gt;
parser.parse(str,dHandler);&lt;br /&gt;
}&lt;br /&gt;
catch (Exception e){&lt;br /&gt;
e.printStackTrace();&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
amazon_ad_tag = "jatepa4u-20"; amazon_ad_width = "728"; amazon_ad_height = "90";//--&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="http://www.assoc-amazon.com/s/ads.js"&gt;&lt;/script&gt;&lt;/div&gt;</description><link>http://javatechpage.blogspot.com/2011/11/simple-sax-parser-example-count-number.html</link><author>noreply@blogger.com (GS)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5732959929032431013.post-5284812507213059938</guid><pubDate>Mon, 21 Nov 2011 14:34:00 +0000</pubDate><atom:updated>2011-11-21T06:34:10.985-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Core Java</category><category domain="http://www.blogger.com/atom/ns#">Java</category><title>What is a constructor and difference between this and super</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span style="background-color: white; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div align="left" style="font-size: 12px; line-height: 12px; margin-bottom: 12px; margin-left: 0px; margin-right: 0px; margin-top: 12px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;/div&gt;&lt;div style="font-family: Verdana, sans-serif; line-height: 18pt; margin-bottom: 9pt; margin-left: 0in; margin-right: 0in; margin-top: 9pt;"&gt;&lt;span style="background-color: white; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="apple-style-span"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Verdana; font-size: 9pt;"&gt;A constructor is a special type of function that gets called every time you initialize a class&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family: Verdana; font-size: 9pt;"&gt;, constructor has the same name as class name. Constructor has no return type not even void. We can pass the parameters to the constructor. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Verdana, sans-serif; line-height: 18pt; margin-bottom: 9pt; margin-left: 0in; margin-right: 0in; margin-top: 9pt;"&gt;&lt;span style="background-color: white; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family: Verdana; font-size: 9pt;"&gt;-this() is used to invoke a constructor of the same class. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Verdana, sans-serif; line-height: 18pt; margin-bottom: 9pt; margin-left: 0in; margin-right: 0in; margin-top: 9pt;"&gt;&lt;span style="background-color: white; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family: Verdana; font-size: 9pt;"&gt;-super() is used to invoke a super class constructor. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Verdana, sans-serif; line-height: 18pt; margin-bottom: 9pt; margin-left: 0in; margin-right: 0in; margin-top: 9pt;"&gt;&lt;span style="background-color: white; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family: Verdana; font-size: 9pt;"&gt;Constructor is called immediately after the object is created before the new operator completes.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Verdana, sans-serif; line-height: 18pt; margin-bottom: 9pt; margin-left: 0in; margin-right: 0in; margin-top: 9pt;"&gt;&lt;span style="background-color: white; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="apple-style-span"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Verdana; font-size: 9pt;"&gt;For example, say you have this class called Person: &lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Verdana; font-size: 9pt;"&gt;class Person &lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Verdana; font-size: 9pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Verdana; font-size: 9pt;"&gt;public Person () &lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Verdana; font-size: 9pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Verdana; font-size: 9pt;"&gt;Console.WriteLine("We're making a new person"); &lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Verdana; font-size: 9pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Verdana; font-size: 9pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Verdana; font-size: 9pt;"&gt;Now you can create a new object of type Person, like this: &lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Verdana; font-size: 9pt;"&gt;Person Tim= new person(); &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Verdana; font-size: 9pt;"&gt;The program will write the line "We're making a new person" to the screen. &lt;/span&gt;&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family: Verdana; font-size: 9pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 18pt; margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;"&gt;&lt;/div&gt;&lt;ul style="font-family: Verdana, sans-serif;"&gt;&lt;li&gt;&lt;span style="background-color: white; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family: Verdana; font-size: 9pt;"&gt;Constructor can use the access modifiers public, protected, private or have no access modifier&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background-color: white; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family: Verdana; font-size: 9pt;"&gt;Constructor can not use the modifiers abstract, static, final, native, synchronized or strictfp&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background-color: white; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family: Verdana; font-size: 9pt;"&gt;Constructor can be overloaded, we cannot override.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background-color: white; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="apple-style-span"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Verdana; font-size: 9pt;"&gt;You cannot use this() and Super() in the same constructor.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background-color: white; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Verdana;"&gt;You can not have both super() and this() invocation in the same constructor.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background-color: white; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Verdana;"&gt;Either super() or this() should be the first statement in the constructor.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="MsoNormal" style="font-family: Verdana, sans-serif;"&gt;&lt;span style="background-color: white; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="apple-style-span"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Verdana; font-size: 9pt;"&gt;&lt;o:p&gt;&lt;b&gt; &lt;/b&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
amazon_ad_tag = "jatepa4u-20"; amazon_ad_width = "728"; amazon_ad_height = "90";//--&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="http://www.assoc-amazon.com/s/ads.js"&gt;&lt;/script&gt;&lt;/div&gt;</description><link>http://javatechpage.blogspot.com/2011/11/what-is-constructor-and-difference.html</link><author>noreply@blogger.com (GS)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5732959929032431013.post-8365616134626948991</guid><pubDate>Mon, 21 Nov 2011 14:31:00 +0000</pubDate><atom:updated>2011-11-21T06:38:02.484-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">dom</category><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">sax</category><category domain="http://www.blogger.com/atom/ns#">xml</category><title>What is the difference between SAX and DOM parsers?</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div class="MsoNormal" style="background-color: white; color: #666666; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size: 12px; line-height: 1.5em; margin-bottom: 12px; margin-left: 0px; margin-right: 0px; margin-top: 12px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;strong style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span style="color: black; font-family: Arial, Bold; font-size: 10pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;DOM Parser:&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="background-color: white; color: #666666; margin-bottom: 12px; margin-left: 0.25in; margin-right: 0px; margin-top: 12px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-indent: -0.25in;"&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-family: Symbol; font-size: 12px; line-height: 18px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman'; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size: 12px; line-height: 18px;"&gt;A DOM (Document Object Model) parser creates a tree structure in memory from an input document and then waits for requests from client.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;A DOM parser always serves the client application with the entire document no matter how much is actually needed by the client.&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Symbol; font-size: 12px; line-height: 18px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman'; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size: 12px; line-height: 18px;"&gt;A DOM parser is rich in functionality. It creates a DOM tree in memory and allows you to access any part of the document repeatedly and allows you to modify the DOM tree. But it is space inefficient when the document is huge, and it takes a little bit longer to learn how to work with it.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div class="MsoNormal" style="background-color: white; color: #666666; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size: 12px; line-height: 1.5em; margin-bottom: 12px; margin-left: 0.25in; margin-right: 0px; margin-top: 12px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-indent: -0.25in;"&gt;&lt;strong style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-indent: 0px;"&gt;SAX Parser:&lt;/strong&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="background-color: white; color: #666666; margin-bottom: 12px; margin-left: 0.25in; margin-right: 0px; margin-top: 12px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-indent: -0.25in;"&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-bottom: 12px; margin-left: 0.25in; margin-right: 0px; margin-top: 12px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-indent: -0.25in;"&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-family: Symbol; font-size: 12px; line-height: 18px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman'; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size: 12px; line-height: 18px;"&gt;A SAX (&lt;/span&gt;&lt;strong style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size: 12px; font-weight: bold; line-height: 18px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;S&lt;/strong&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size: 12px; line-height: 18px;"&gt;imple &lt;/span&gt;&lt;strong style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size: 12px; font-weight: bold; line-height: 18px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;A&lt;/strong&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size: 12px; line-height: 18px;"&gt;PI for &lt;/span&gt;&lt;strong style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size: 12px; font-weight: bold; line-height: 18px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;X&lt;/strong&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size: 12px; line-height: 18px;"&gt;ML) parser does not create any internal structure. Instead, it takes the occurrences of components of an input document &lt;/span&gt;&lt;strong style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size: 12px; font-weight: bold; line-height: 18px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;as events&lt;/strong&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size: 12px; line-height: 18px;"&gt;, and tells the client what it reads as it reads through the input document.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Symbol; font-size: 12px; line-height: 18px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman'; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size: 12px; line-height: 18px;"&gt;A SAX parser serves the client application always only with pieces of the document at any given time.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Symbol; font-size: 12px; line-height: 18px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman'; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size: 12px; line-height: 18px;"&gt;A SAX parser, however, is much more space efficient in case of a big input document (because it creates no internal structure). What’s more, it runs faster and is easier to learn than DOM parser because its API is really simple. But from the functionality point of view, it provides a fewer functions, which means that the users themselves have to take care of more, such as creating their own data structures.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
amazon_ad_tag = "jatepa4u-20"; amazon_ad_width = "728"; amazon_ad_height = "90";//--&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="http://www.assoc-amazon.com/s/ads.js"&gt;&lt;/script&gt;&lt;/div&gt;</description><link>http://javatechpage.blogspot.com/2011/11/what-is-difference-between-sax-and-dom.html</link><author>noreply@blogger.com (GS)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5732959929032431013.post-7208152676197385813</guid><pubDate>Mon, 21 Nov 2011 14:30:00 +0000</pubDate><atom:updated>2011-11-21T06:30:38.386-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Core Java</category><category domain="http://www.blogger.com/atom/ns#">Java</category><title>What are the differences between finalize(), final and finally</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;ul style="background-color: white; margin: 12px 0px; padding: 0px 0px 0px 40px;"&gt;&lt;li style="color: #666666; font-family: 'Lucida Grande','Lucida Sans Unicode',Verdana,sans-serif; font-size: 12px; margin: 0px; padding: 0px;"&gt;&lt;strong style="font-weight: bold; margin: 0px; padding: 0px;"&gt;finalize()&lt;/strong&gt; – method helps in garbage collection. A method that is invoked before an object is discarded by the garbage collector, allowing it to clean up its state. Should not be used to release non-memory resources like file handles, sockets, database connections etc because Java has only a finite number of these resources and you do not know when the garbage collection is going to kick in to release these non-memory resources through the finalize() method.&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li style="color: #666666; font-family: 'Lucida Grande','Lucida Sans Unicode',Verdana,sans-serif; font-size: 12px; margin: 0px; padding: 0px;"&gt;&lt;strong style="font-weight: bold; margin: 0px; padding: 0px;"&gt;finally&lt;/strong&gt; – The finally block &lt;em style="margin: 0px; padding: 0px;"&gt;always&lt;/em&gt; executes when the try block exits, except System.exit(0) call. This ensures that the finally block is executed even if an unexpected exception occurs. It allows the programmer to avoid having clean up code accidentally bypassed by a return, continue, or break. Keeping the clean up code in a finally block is always a good practice, even when no exceptions are anticipated.&lt;/li&gt;
&lt;li style="color: #666666; font-family: 'Lucida Grande','Lucida Sans Unicode',Verdana,sans-serif; font-size: 12px; margin: 0px; padding: 0px;"&gt;&lt;strong style="font-weight: bold; margin: 0px; padding: 0px;"&gt;final&lt;/strong&gt; – This is useful in several ways...&lt;/li&gt;
&lt;/ul&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #666666; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size: 12px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;When it is used with variable declaration, it becomes constant&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="background-color: white; color: #666666; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size: 12px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;When it is used with method, the method cant be &lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #666666; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size: 12px;"&gt;overridden&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #666666; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size: 12px;"&gt; by the child class&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="background-color: white; color: #666666; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size: 12px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;When it is used with the class, the class cant have child classes.&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
amazon_ad_tag = "jatepa4u-20"; amazon_ad_width = "728"; amazon_ad_height = "90";//--&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="http://www.assoc-amazon.com/s/ads.js"&gt;&lt;/script&gt;&lt;/div&gt;</description><link>http://javatechpage.blogspot.com/2011/11/what-are-differences-between-finalize.html</link><author>noreply@blogger.com (GS)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5732959929032431013.post-6262902481313153385</guid><pubDate>Mon, 21 Nov 2011 14:29:00 +0000</pubDate><atom:updated>2011-11-21T06:29:15.626-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Core Java</category><category domain="http://www.blogger.com/atom/ns#">Java</category><title>What are the differences between HashMap and Hashtable?</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span class="Apple-style-span" style="background-color: white; font-family: Verdana, Arial, Helvetica;"&gt;Both  provide key-value access to data. The Hashtable is one of the original  collection classes in Java. HashMap is part of the new Collections  Framework, added with Java 2, v1.2.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, Arial, Helvetica;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div style="background-color: white; font-family: Verdana,Arial,Helvetica; font-size: small;"&gt;The  key difference between the two is that access to the Hashtable is  synchronized on the table while access to the HashMap isn't. You can add  it, but it isn't there by default.&lt;/div&gt;&lt;div style="background-color: white; font-family: Verdana,Arial,Helvetica; font-size: small;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="background-color: white; font-family: Verdana,Arial,Helvetica; font-size: small;"&gt;Another  difference is that iterator in the HashMap is fail-safe while the  enumerator for the Hashtable isn't. If you change the map while  iterating, you'll know.&lt;/div&gt;&lt;div style="background-color: white; font-family: Verdana,Arial,Helvetica; font-size: small;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="background-color: white; font-family: Verdana,Arial,Helvetica; font-size: small;"&gt;And, a third difference is that HashMap permits null values in it, while Hashtable doesn't.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
amazon_ad_tag = "jatepa4u-20"; amazon_ad_width = "728"; amazon_ad_height = "90";//--&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="http://www.assoc-amazon.com/s/ads.js"&gt;&lt;/script&gt;&lt;/div&gt;</description><link>http://javatechpage.blogspot.com/2011/11/what-are-differences-between-hashmap.html</link><author>noreply@blogger.com (GS)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5732959929032431013.post-2860946921588215288</guid><pubDate>Mon, 21 Nov 2011 14:27:00 +0000</pubDate><atom:updated>2011-11-21T06:27:11.316-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Core Java</category><category domain="http://www.blogger.com/atom/ns#">Java</category><title>Synchronizing a HashMap</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;br /&gt;
How to make hashmap operations synchronized?&lt;br /&gt;
&lt;br /&gt;
For JDK 5 or after, we can use ConcurrentHashMap . This is an efficient implementation of a concurrent hash map using different locks for different portions of the HashMap . This reduces the contention of the lock and hence increase throughput tremendously as compared to a synchronized Map.&lt;br /&gt;
&lt;br /&gt;
For JDK versions before JDK5 there is a back port &amp;nbsp;of the same, if we do not want to use that, then we can use Collections.synchronizedMap() method to create a synchronized map. The new map will be backed with the original map and all the access will be synchronized on a single monitor. Also, we have to do external synchronization while iterating over the map entries.&lt;br /&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
amazon_ad_tag = "jatepa4u-20"; amazon_ad_width = "728"; amazon_ad_height = "90";//--&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="http://www.assoc-amazon.com/s/ads.js"&gt;&lt;/script&gt;&lt;/div&gt;</description><link>http://javatechpage.blogspot.com/2011/11/synchronizing-hashmap.html</link><author>noreply@blogger.com (GS)</author><thr:total>0</thr:total></item></channel></rss>