<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-3166332459178575831</atom:id><lastBuildDate>Fri, 10 Apr 2026 11:57:18 +0000</lastBuildDate><category>JAVA</category><category>JAVA INTERVIEW QUESTIONS</category><category>J2EE</category><category>J2EE INTERVIEW QUESTIONS</category><category>SERVLET</category><category>SERVLET INTERVIEW QUESTIONS</category><category>SQL</category><category>SQL INTERVIEW QUESTIONS</category><category>SQL TUTORIAL</category><category>FRAMEWORK</category><category>FRAMEWORK INTERVIEW QUESTIONS</category><category>INTERNET</category><category>INTERNET INTERVIEW QUESTIONS</category><category>HIBERNATE</category><category>HIBERNATE INTERVIEW QUESTIONS</category><category>SPRING</category><category>SPRING INTERVIEW QUESTIONS</category><category>STRUTS</category><category>STRUTS INTERVIEW QUESTIONS</category><category>JAVA DESIGN PATTERNS</category><category>JSP</category><category>JSP INTERVIEW QUESTION</category><title>JAVA INTERVIEW QUESTIONS</title><description>Interview questions on Java, J2EE, Spring, Struts, Hibernate</description><link>http://interviewquestionjava.blogspot.com/</link><managingEditor>noreply@blogger.com (Anijit Sarkar)</managingEditor><generator>Blogger</generator><openSearch:totalResults>69</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3166332459178575831.post-285934868437279829</guid><pubDate>Mon, 10 Feb 2014 07:27:00 +0000</pubDate><atom:updated>2014-02-13T13:11:36.946+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">JAVA</category><category domain="http://www.blogger.com/atom/ns#">JAVA DESIGN PATTERNS</category><category domain="http://www.blogger.com/atom/ns#">JAVA INTERVIEW QUESTIONS</category><title>JAVA: Singleton Pattern - Concept and 7 Most Popular Implementation Style</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;Singleton in one of the most popular yet controversial design pattern, in the world of object oriented programming. It&#39;s one of those patterns, that every developer comes to know first and again it&#39;s one of of those patterns, that even experience developers get confused with it&#39;s proper implementation style. So, over here, we will first take a deeper look on &lt;b&gt;&lt;i&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2014/02/java-singleton-pattern-concept-and.html#singleton_concept&quot;&gt;the concept of Singleton design pattern&lt;/a&gt;&lt;/i&gt;&lt;/b&gt; and then we will discuss all the &lt;b&gt;&lt;i&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2014/02/java-singleton-pattern-concept-and.html#implementation_style&quot;&gt;popular implementation styles&amp;nbsp;of Singleton in java with suitable examples&lt;/a&gt;&lt;/i&gt;&lt;/b&gt;.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;This post is a little bit bigger than usual. So please be patient, because it&#39;s worth reading.&lt;/span&gt;&lt;br /&gt;
&lt;a href=&quot;https://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; name=&quot;singleton_concept&quot;&gt;&lt;/a&gt;

&lt;br /&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;h1 style=&quot;color: #104e8b;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;Concept&lt;/span&gt;&lt;/h1&gt;
&lt;div style=&quot;background-color: #104e8b; height: 3px; width: 600px;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;

&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp;Singleton&lt;/b&gt; is a &lt;b&gt;software design pattern&lt;/b&gt; to limit the instantiation of a class to one, which will be globally accessible. &amp;nbsp;That means it’s a technique by which a class only have one instance/object and this object can be &lt;b&gt;accessed globally&lt;/b&gt;. It is a part of &lt;a href=&quot;http://c2.com/cgi/wiki?GangOfFour&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;Gang of Four design pattern&lt;/b&gt;&lt;/a&gt; and it comes under &lt;b&gt;creational design patterns&lt;/b&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Applications, often needs to create single instance of a class, and that instance will be used throughout the application. Examples like logging, database access, etc. We could pass such an instance from method to method, or we can also assign it to each object in the application. But, that will create lots of complexity. On the other hand, we could use a single instance to communicate with a class. Hence, the class could create and manage a single instance of its own. And when needed, just talk to that class.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3 style=&quot;color: #4488dd;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;Principles of Singleton&lt;/span&gt;&lt;/h3&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;
Therefore, the principles of Singleton design pattern are -&lt;/span&gt;&lt;br /&gt;
&lt;i&gt;&lt;b&gt;&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;1.&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;The implementing class should have only one instance.&lt;/span&gt;&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;b&gt;&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;2.&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Access point of this single instance should be global.&lt;/span&gt;&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;b&gt;Example of Singleton class in Java:&lt;/b&gt; One of the most popular singleton examples is &lt;b&gt;&lt;i&gt;java.lang.Runtime&lt;/i&gt;&lt;/b&gt; class. It’s a singleton class, you can’t initialize this class, but you can get the instance by calling &lt;i&gt;&lt;b&gt;getRuntime()&lt;/b&gt;&lt;/i&gt; method.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;a href=&quot;https://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; name=&quot;structure&quot;&gt;&lt;/a&gt;

&lt;br /&gt;
&lt;h2 style=&quot;color: #4488bb;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;Structure&lt;/span&gt;&lt;/h2&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;So, &lt;b&gt;what will be the structure of a singleton class?&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8555Iva9OiTc0ZP7U5dx82rGuSMB3WB_MOTR7ygXt1EgLnEmiDxB0zb1uTVQtFEVWf0zgoXiBAlESAolLf6n9Pi-GR6cZd42J36pl5flT8ZRmhg1AP0Ca7F2neaeZ2E5Lu0kAE9Sggug/s1600/Singleton-structure.JPG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;img alt=&quot;Singleton - structure&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8555Iva9OiTc0ZP7U5dx82rGuSMB3WB_MOTR7ygXt1EgLnEmiDxB0zb1uTVQtFEVWf0zgoXiBAlESAolLf6n9Pi-GR6cZd42J36pl5flT8ZRmhg1AP0Ca7F2neaeZ2E5Lu0kAE9Sggug/s1600/Singleton-structure.JPG&quot; title=&quot;Singleton - structure&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Well, it should contain the following properties:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;
1.&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;It should have a &lt;b&gt;&lt;i&gt;private static member of the class&lt;/i&gt;&lt;/b&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;
2.&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;i&gt;The constructor should be private&lt;/i&gt;&lt;/b&gt;, so that, no one from outside can initialize this class.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;
3.&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;i&gt;A public static method which will expose the private member&lt;/i&gt;&lt;/b&gt; of the class to the outer world.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;a href=&quot;https://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; name=&quot;static_vs_singleton&quot;&gt;&lt;/a&gt;

&lt;br /&gt;
&lt;h2 style=&quot;color: #4488bb;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;What if we use static class instead of Singleton?&lt;/span&gt;&lt;/h2&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Now, question may come, what if we use a &lt;a href=&quot;http://interviewquestionjava.blogspot.com/2012/01/what-is-static-in-java.html&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;static&lt;/b&gt;&lt;/a&gt; class instead of a Singleton class?&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp;Well, there are some advantages of using Singleton over static class.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;
1.&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Static class can only have &lt;b&gt;static members&lt;/b&gt;, where in Singleton pattern implemented class can have&lt;b&gt; non-static members&lt;/b&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;
2.&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;A Singleton class can implement &lt;b&gt;interfaces&lt;/b&gt; as well as extend classes but a static class can &lt;b&gt;extend&lt;/b&gt; classes, without inheriting their instance members.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;
3.&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;A static class can’t be a top level class. It should be always &lt;a href=&quot;http://interviewquestionjava.blogspot.com/2012/01/java-nested-class.html&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;nested class&lt;/b&gt;&lt;/a&gt;. That means, under some non-static class. Because, by definition &lt;a href=&quot;http://interviewquestionjava.blogspot.com/2012/01/what-is-static-in-java.html&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;static&lt;/b&gt;&lt;/a&gt; means that it belongs to a class it is in.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;
4.&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;We can &lt;b&gt;clone an object&lt;/b&gt; of a Singleton class, but in static class, that is not possible.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;
5.&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Again, Singleton supports the features like &lt;b&gt;polymorphism&lt;/b&gt; while, for a static class it’s not possible.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;
6.&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Singleton classes can also supports the &lt;b&gt;lazy loading&lt;/b&gt; facility, which is not supported in a static class.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;a href=&quot;https://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; name=&quot;implementation_style&quot;&gt;
&lt;/a&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h1 style=&quot;color: #104e8b;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;Implementation Styles&lt;/span&gt;&lt;/h1&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: #104e8b; height: 3px; width: 600px;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;In Java programming language, Singleton pattern can be archive by different implementation style. Each has some pros and corns. One single style is not suitable for every situation. So I think you should know, all of them, and use it as per your requirement. &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp;Now, we are going to discuss about some of the most popular implementation style.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;strong style=&quot;color: #4488dd; font-size: 22px;&quot;&gt;&lt;b&gt;7 most popular implementation style of singleton design pattern in java:&lt;/b&gt;&lt;/strong&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;b&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2014/02/java-singleton-pattern-concept-and.html#simple_lazy_initialization&quot;&gt;&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;Simple &lt;/span&gt;Lazy Initialization&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2014/02/java-singleton-pattern-concept-and.html#thread_safe_lazy_initialization&quot;&gt;&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Thread Safe Lazy Initialization&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2014/02/java-singleton-pattern-concept-and.html#double_check_locking&quot;&gt;&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Double Check Locking&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2014/02/java-singleton-pattern-concept-and.html#eagar_initialization&quot;&gt;&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Eager Initialization&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2014/02/java-singleton-pattern-concept-and.html#static_block_initialization&quot;&gt;&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Static Block Initialization&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2014/02/java-singleton-pattern-concept-and.html#demand_holder_idiom&quot;&gt;&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Demand Holder Idiom by Bill Pugh&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2014/02/java-singleton-pattern-concept-and.html#enum_singleton_implementation&quot;&gt;&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Using enum by Joshua Bloch&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;h2&gt;
&lt;a href=&quot;https://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; name=&quot;simple_lazy_initialization&quot;&gt;&lt;/a&gt;
&lt;span style=&quot;color: #4488bb; font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;
Simple Lazy Initialization:&lt;/span&gt;&lt;/h2&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;The &lt;b&gt;lazy initialization singleton&lt;/b&gt; implementation style initializes the instance of a singleton class when it’s first being used. That means, the private static instance, (that is described in Structure) is initialized not during the class load, but during its first use. Lazy initialization is very helpful, when is object cost of a singleton class is high, i.e., it may take lots of time or memory.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;It&#39;s only loaded, when it&#39;s actually being used.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;b&gt;Simple Lazy Initialization&lt;/b&gt;&amp;nbsp;is the most basic style for &lt;b&gt;lazy loading&lt;/b&gt;. It&#39;s good for the newbies to understand the concept and structure of Singleton pattern.The concept of this&amp;nbsp;style is to declare the private static instance of the class by setting the initial value as null during class load, keeping the actual initialization for the first call. That means, the actual initialization of the single instance of the class is only happening when for the first time the class has been called.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Let’s take a look on the below example. The class LazyInitializationThreadUnsafe is a singleton class, which contains a counter, every time called gives you a sequential incremental number.&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Example: Class LazyInitializationThreadUnsafe&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;div style=&quot;background: #F2F2F2; border: solid windowtext 1.0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div; padding: 1.0pt 1.0pt 1.0pt 1.0pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;package &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;interview.question.java.singleton;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/**&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* The class
LazyInitializationThreadUnsafe is Singleton Class suitable for&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* single thread
application. This class also provides a public method named&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* counter() which will
always returns integer type sequenced counter value&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f9fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;@author&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt; Java Interview Questions
[&lt;a href=&quot;http://interviewquestionjava.blogspot.com/&quot;&gt;http://interviewquestionjava.blogspot.com&lt;/a&gt;]&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;**/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;public class &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;LazyInitializationThreadUnsafe
{&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* The integer type counter will hold the value
of the counter. The scope of&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* this field is private, so its only
accessible via the counter method.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* It&#39;s static so that only one copy of this
variable will be available&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* within the memory.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;private static int &lt;/span&gt;&lt;/b&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;counter&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; = 0;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* The static private member instance of type
LazyInitializationThreadUnsafe&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* Class will hold the single instance of this
class.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;private static &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;LazyInitializationThreadUnsafe
&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;instance&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; = &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;null&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* The constructor of the
LazyInitializationThreadUnsafe class is in private&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* scope so that, no one can initialize this
class.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;private &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;LazyInitializationThreadUnsafe()
{&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&quot;LazyInitializationThreadUnsafe.LazyInitializationThreadUnsafe()&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* The method getInstance() will return the
only instance of the class&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* LazyInitializationThreadUnsafe. It will
initialize the object if the&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* instance is null by accessing the private
constructor of this class.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;public static &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;LazyInitializationThreadUnsafe getInstance()
{&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;if&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; (&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;instance&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; == &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;null&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;) {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;instance&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; = &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;new &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;LazyInitializationThreadUnsafe();&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;return &lt;/span&gt;&lt;/b&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;instance&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* This sample method will increase the counter
by 1 and returns its value.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;public int&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; counter() {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;counter&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;++;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&quot;LazyInitializationThreadUnsafe.counter()&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;return &lt;/span&gt;&lt;/b&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;counter&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;o:p&gt;Here, we are first declaring the class instance as null.&lt;/o:p&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: #F2F2F2; border: solid windowtext 1.0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div; padding: 1.0pt 1.0pt 1.0pt 1.0pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;private static&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;LazyInitializationThreadUnsafe&amp;nbsp;&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;instance&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; = &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;null&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Now, when globally accessible &lt;i&gt;getInstance()&lt;/i&gt; is called, &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;1. it will check if the instance is null or not.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;2. if null&amp;nbsp;initialize&amp;nbsp;it.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;3. return the instance.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: #F2F2F2; border: solid windowtext 1.0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div; padding: 1.0pt 1.0pt 1.0pt 1.0pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;if&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; (&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;instance&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; == &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;null&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;) {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;instance&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; = &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;new&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;LazyInitializationThreadUnsafe();&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;So, it will be initialize only for the first time the &lt;i&gt;getInstance()&lt;/i&gt; method has been called.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;But, this style is not thread safe. Its only good for single threaded environment.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;h4 style=&quot;color: #4488bb;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;
Life cycle:&lt;/span&gt;&lt;/h4&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Initializes during first use.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Destroyed at application shutdown.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h4 style=&quot;color: #4488bb;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;
Pros:&lt;/span&gt;&lt;/h4&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;It supports lazy initialization, so it will only been loaded to the memory when it’s actually needed for the first time.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h4 style=&quot;color: #4488bb;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;
Corns:&lt;/span&gt;&lt;/h4&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;It’s preferable only on single thread environment.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;h2&gt;
&lt;a href=&quot;https://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; name=&quot;thread_safe_lazy_initialization&quot;&gt;&lt;/a&gt;
&lt;span style=&quot;color: #4488bb; font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;
Thread Safe Lazy Initialization:&lt;/span&gt;&lt;/h2&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;The concept of this style is same as other lazy initialization style; the only difference with the previous lazy initialization style is its thread safe.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Let’s take a look on an example. The below class LazyInitializationThreadSafe is a thread safe lazy initialization style.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;Example: Class LazyInitializationThreadSafe&lt;/b&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background: #F2F2F2; border: solid windowtext 1.0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div; padding: 1.0pt 1.0pt 1.0pt 1.0pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;package&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;interview.question.java.singleton;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/**&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* The class
LazyInitializationThreadSafe is Singleton Class suitable for&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;u&gt;multithreaded&lt;/u&gt;
application.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* This class also
provides a public method named counter()&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* which will always
returns integer type sequenced counter value &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f9fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;@author&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt; Java Interview Questions
[&lt;a href=&quot;http://interviewquestionjava.blogspot.com/&quot;&gt;http://interviewquestionjava.blogspot.com&lt;/a&gt;]&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;**/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;public class &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;LazyInitializationThreadSafe
{&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* The integer type counter will hold the &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* value of the counter.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* The scope of this field is private, so its &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* only accessible via the counter method.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* It&#39;s static so that only one copy of this
variable&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* will be available within the memory.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;Private static int&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;counter&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; = 0;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* The static private member instance of type
LazyInitializationThreadSafe&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* Class will hold the single instance of this
class.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;private static&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;LazyInitializationThreadSafe&amp;nbsp;&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;instance&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; = &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;null&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* The constructor of the
LazyInitializationThreadSafe class is in&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* private scope so that, no one can initialize
this class.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;private&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;LazyInitializationThreadSafe() {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&quot;LazyInitializationThreadSafe.LazyInitializationThreadSafe()&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* The static method getInstance() will return
the only instance&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* of the&amp;nbsp;
class LazyInitializationThreadSafe.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* It will initialize the object if the &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* instance is null by accessing the private
constructor &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* of this class.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* The method getInstance() is synchronized to
make it thread safe.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;public static synchronized&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;LazyInitializationThreadSafe getInstance()
{&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;if&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; (&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;instance&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; == &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;null&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;) {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;instance&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; = &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;new&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;LazyInitializationThreadSafe();&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;return&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;instance&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* This sample method will increase the counter
&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* by 1 and returns its value.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;public int&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; counter() {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;counter&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;++;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&quot;LazyInitializationThreadSafe.counter()&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;return&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;counter&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Now, in this class you will find only one difference from the previous example (Class LazyInitializationThreadUnsafe), that is, I use the&amp;nbsp;&lt;b&gt;&lt;span style=&quot;background: #BFBFBF; color: #7f0055; font-size: 8.0pt; line-height: 110%; mso-ansi-language: EN-US; mso-bidi-font-family: Consolas; mso-bidi-language: AR-SA; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: JA; mso-fareast-theme-font: minor-fareast; mso-shading-themecolor: background1; mso-shading-themeshade: 191;&quot;&gt;synchronized&lt;/span&gt;&lt;span style=&quot;color: #7f0055; font-size: 8.0pt; line-height: 110%; mso-ansi-language: EN-US; mso-bidi-font-family: Consolas; mso-bidi-language: AR-SA; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: JA; mso-fareast-theme-font: minor-fareast;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;Now, in this class &lt;i&gt;getInstance() &lt;/i&gt;method. That&amp;nbsp;means, concurrent threads will use this method in atomic way. Thus, it’s safe from concurrent usage of this method by multiple threads. And it becomes thread safe.&lt;/span&gt;&lt;/div&gt;
&lt;h4 style=&quot;color: #4488bb;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;
Life cycle:&lt;/span&gt;&lt;/h4&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Initializes during first use.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Destroyed at application shutdown.&lt;/span&gt;&lt;br /&gt;
&lt;h4 style=&quot;color: #4488bb;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;
Pros:&lt;/span&gt;&lt;/h4&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Thread safe&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;It uses lazy loading so it’s been initialized during its actual usage.&lt;/span&gt;&lt;br /&gt;
&lt;h4 style=&quot;color: #4488bb;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;
Corns:&lt;/span&gt;&lt;/h4&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;A bit slower that not thread safe style, the &lt;i&gt;getInstance()&lt;/i&gt; goes through synchronized method. So it’s locking the resource every time you call it.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;a href=&quot;https://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; name=&quot;double_check_locking&quot;&gt;&lt;/a&gt;

&lt;/span&gt;&lt;br /&gt;
&lt;h2 style=&quot;color: #4488bb;&quot;&gt;
&lt;span style=&quot;color: #4488bb; font-family: Trebuchet MS, sans-serif;&quot;&gt;
Double Check Locking:&lt;/span&gt;&lt;/h2&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;Another technique to implement thread safe lazy initialization is &lt;b&gt;double check locking&lt;/b&gt;. This concept will work fine in Java 5 or above. &amp;nbsp;This concept is introduced to optimize the &lt;b&gt;thread safe lazy initialization style&lt;/b&gt; of the Singleton pattern, which locks the resources, every time you try to get the instance of the class using a public scoped method.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Let’s see in details by the example class DoubleCheckLock.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;Example: Class DoubleCheckLock&lt;/b&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background: #F2F2F2; border: solid windowtext 1.0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div; padding: 1.0pt 1.0pt 1.0pt 1.0pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;package&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;interview.question.java.singleton;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/**&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* The class
DoubleCheckLock is Singleton Class which implements the double&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* check lock style. This
class also provides a public method named counter()&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* which will always
returns integer type sequenced counter value&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f9fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;@author&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt; Java Interview Questions
[&lt;a href=&quot;http://interviewquestionjava.blogspot.com/&quot;&gt;http://interviewquestionjava.blogspot.com&lt;/a&gt;]&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;**/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;public class&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;DoubleCheckLock {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* The static private member instance of type
DoubleCheckLock Class will&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* hold the single instance of this class.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;private static volatile&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;DoubleCheckLock&amp;nbsp;&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;instance&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; = &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;null&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* The integer type counter will hold the value
of the counter. The scope of&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* this field is private, so its only
accessible via the counter method.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* It&#39;s static so that only one copy of this
variable will be available&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* within the memory.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;private static int&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;counter&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; = 0;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* The constructor of the
DoubleCheckLock class is in private&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* scope so that, no one can initialize this
class.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;private&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;DoubleCheckLock() {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&quot;DoubleCheckLock.DoubleCheckLock()&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* The method getInstance() will return the
only instance of the class&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* DoubleCheckLock. It will initialize the
object if the instance is null by&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* accessing the private constructor of this
class.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;public static&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;DoubleCheckLock getInstance()
{&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;if&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; (&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;instance&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; == &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;null&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;) {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;synchronized&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; (DoubleCheckLock.&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;class&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;) {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;if&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; (&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;instance&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; == &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;null&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;) {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;instance&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; = &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;new&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;DoubleCheckLock();&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;return&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;instance&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* This sample method will increase the counter
by 1 and returns its value.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;public int&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; counter() {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;counter&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;++;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&quot;DoubleCheckLock.counter()&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;return&lt;/span&gt;&lt;/b&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;counter&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Now, over here if you see, you will find the difference is in technique of initializing the instance inside &lt;i&gt;getInstance()&lt;/i&gt; method.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: #F2F2F2; border: solid windowtext 1.0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div; padding: 1.0pt 1.0pt 1.0pt 1.0pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;if&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; (&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;instance&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; == &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;null&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;) {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;synchronized&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; (DoubleCheckLock.&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;class&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;) {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;if&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; (&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;instance&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; == &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;null&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;) {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;instance&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; = &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;new&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;DoubleCheckLock();&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;Here, what we are doing is,&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;1.&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Checking if the instance has been initialized or not.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;2.&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;If not, creating locks by using synchronized.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;3.&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Again checking if the instance is already initialized or not.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;4.&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;If still not, then initializing the instance of the class.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;This is been introduced as in previous example (class LazyInitializationThreadSafe), we always locking the method &lt;i&gt;getInstance()&lt;/i&gt;, every time it’s been called. While, it’s only need when its initializing the instance.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;You can also see that, we use the&amp;nbsp;&lt;b&gt;&lt;span style=&quot;background: #BFBFBF; color: #7f0055; font-size: 8.0pt; line-height: 110%; mso-ansi-language: EN-US; mso-bidi-font-family: Consolas; mso-bidi-language: AR-SA; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: JA; mso-fareast-theme-font: minor-fareast; mso-shading-themecolor: background1; mso-shading-themeshade: 191;&quot;&gt;volatile&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 10.0pt; line-height: 110%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: JA; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin;&quot;&gt;&amp;nbsp;&lt;/span&gt;keyword, when declaring the instance of the class. That’s, to inform the&amp;nbsp;JVM that writes to the field should always be synchronously flushed to memory, and that reads of the field should always read from memory.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;h4 style=&quot;color: #4488bb;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;
Life cycle:&amp;nbsp;&lt;/span&gt;&lt;/h4&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Initializes during first use.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Destroyed at application shutdown.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;h4 style=&quot;color: #4488bb;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;
Pros:&lt;/span&gt;&lt;/h4&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Thread safe style.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Doing lazy loading.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Performance wise it’s faster than Thread safe lazy initialization as its only locking during initialization.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;h4 style=&quot;color: #4488bb;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;
Corns:&lt;/span&gt;&lt;/h4&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; Code complexity.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; Should only use in java 5 or above.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;a href=&quot;https://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; name=&quot;eagar_initialization&quot;&gt;&lt;/a&gt;

&lt;/span&gt;&lt;br /&gt;
&lt;h2 style=&quot;color: #4488bb;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Early or Eager Initialization&lt;/span&gt;&lt;/h2&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;b&gt;Early or eager initialization style&lt;/b&gt; is to initialize the instance of a singleton class during class loading. This style is very effective, if the instance is not that costly. In this technique, the instance of the class has been initialized during its declaration and marked with &lt;a href=&quot;http://interviewquestionjava.blogspot.com/2012/01/what-is-final.html&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;final&lt;/b&gt;&lt;/a&gt; keyword, so that it can’t be modified. One more benefit of using this style is, it’s totally thread safe.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Let us see by using an example singleton class EagerInitialization.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;Example: Class EagerInitialization&lt;/b&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background: #F2F2F2; border: solid windowtext 1.0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div; padding: 1.0pt 1.0pt 1.0pt 1.0pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;package&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;interview.question.java.singleton;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/**&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* The class
EagerInitialization is Singleton Class which implements &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* the Eager
Initialization style suitable for both single &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* threaded&amp;nbsp; or &lt;u&gt;multithreaded&lt;/u&gt; application.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* This class also
provides a public method named counter()&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* which will always returns
integer type sequenced counter value &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f9fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;@author&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt; Java Interview Questions
[&lt;a href=&quot;http://interviewquestionjava.blogspot.com/&quot;&gt;http://interviewquestionjava.blogspot.com&lt;/a&gt;]&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;**/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;public class&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;EagerInitialization {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* The integer type counter will hold the &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* value of the counter.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* The scope of this field is private, so its &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* only accessible via the counter method.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* It&#39;s static so that only one copy of this
variable&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* will be available within the memory.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;private static int&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;counter&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; = 0;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* The static private member instance of type
EagerInitialization&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* Class will hold the single instance of this
class.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;private static final&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;EagerInitialization&amp;nbsp;&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;INSTANCE&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; = &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;new&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;EagerInitialization();&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* The constructor of the EagerInitialization
class is in&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* private scope so that, no one can initialize
this class.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;private&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;EagerInitialization() {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&quot;EagerInitialization.EagerInitialization()&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* The static method getInstance() will return
the only instance&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* of the&amp;nbsp;
class EagerInitialization.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;public static&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;EagerInitialization getInstance()
{&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;return&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;INSTANCE&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* This sample method will increase the counter
&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* by 1 and returns its value.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;public int&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; counter() {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;counter&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;++;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&quot;EagerInitialization.counter()&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;return&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;counter&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;In this example, you can see its simply initializing the instance during declaration under private static final clause. And returns it via a public static method &lt;i&gt;getInstance()&lt;/i&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;h4 style=&quot;color: #4488bb;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;
Life cycle:&lt;/span&gt;&lt;/h4&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Initializes during class load.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Destroyed at application shutdown.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;h4 style=&quot;color: #4488bb;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Pros:&lt;/span&gt;&lt;/h4&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Thread safe.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Performance wise, faster than lazy initialization, as it’s not locking any resource by synchronized.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;The instance is final, so scope of redefining, thus, no scope of multiple instance.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;h4 style=&quot;color: #4488bb;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Corns:&lt;/span&gt;&lt;/h4&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Initializes during class load, so it is occupying memory, even when it’s not required.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;a href=&quot;https://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; name=&quot;static_block_initialization&quot;&gt;&lt;/a&gt;

&lt;/span&gt;&lt;br /&gt;
&lt;h2 style=&quot;color: #4488bb;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Static block initialization&lt;/span&gt;&lt;/h2&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;b&gt;Static block initializing&lt;/b&gt; is another style of &lt;b&gt;early initialization&lt;/b&gt;. The only difference is you are initializing the instance of the class under a static block with error checking.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Now, try it with this example class StaticBlockInitialization.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;Example: Class StaticBlockInitialization&lt;/b&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background: #F2F2F2; border: solid windowtext 1.0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div; padding: 1.0pt 1.0pt 1.0pt 1.0pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;package&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;interview.question.java.singleton;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/**&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* The class
StaticBlockInitialization is Singleton Class which implements the&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* Static Block
Initialization style. This class also provides a public method&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* named counter() which
will always returns integer type sequenced counter&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* value&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f9fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;@author&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt; Java Interview Questions
[&lt;a href=&quot;http://interviewquestionjava.blogspot.com/&quot;&gt;http://interviewquestionjava.blogspot.com&lt;/a&gt;]&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;**/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;public class&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;StaticBlockInitialization {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* The integer type counter will hold the value
of the counter. The scope of&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* this field is private, so its only
accessible via the counter method.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* It&#39;s static so that only one copy of this
variable will be available&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* within the memory.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;private static int&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;counter&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* The static private member instance of type
StaticBlockInitialization&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* Class will hold the single instance of this
class.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;private static final&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;StaticBlockInitialization&amp;nbsp;&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;INSTANCE&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* Initializing static members under static
block&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;static&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;try&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;INSTANCE&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; = &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;new&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;StaticBlockInitialization();&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;counter&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; = 0;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;catch&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; (Exception e) {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;throw new&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;RuntimeException(e.getMessage(),
e);&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* The constructor of the
StaticBlockInitialization class is in private&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* scope so that, no one can initialize this
class.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;private&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;StaticBlockInitialization() {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&quot;StaticBlockInitialization.StaticBlockInitialization()&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* The static method getInstance() will return
the only instance of the&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* classStaticBlockInitialization.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;public static&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;StaticBlockInitialization getInstance()
{&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;return&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;INSTANCE&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* This sample method will increase the counter
by 1 and returns its value.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;public int&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; counter() {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;counter&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;++;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&quot;StaticBlockInitialization.counter()&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;return&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;counter&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Here, you can see we are initializing the instance of the class under a static block. And we are also doing it under try catch block, to provide an error check during initialization.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;

&lt;/span&gt;&lt;br /&gt;
&lt;h4 style=&quot;color: #4488bb;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Life cycle:&lt;/span&gt;&lt;/h4&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Initializes during class load.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Destroyed at application shutdown.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;h4 style=&quot;color: #4488bb;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Pros:&lt;/span&gt;&lt;/h4&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Thread safe.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Performance wise, faster than lazy initialization, as it’s not locking any resource by synchronized.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;The instance is final, so scope of redefining, thus, no scope of multiple instance.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Initializing under try catch block for error check.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;h4 style=&quot;color: #4488bb;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Corns:&lt;/span&gt;&lt;/h4&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Initializes during class load, so it is occupying memory, even when it’s not required.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;a href=&quot;https://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; name=&quot;demand_holder_idiom&quot;&gt;&lt;/a&gt;

&lt;/span&gt;&lt;br /&gt;
&lt;h2 style=&quot;color: #4488bb;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Demand Holder Idiom by Bill Pugh&lt;/span&gt;&lt;/h2&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;Again back to &lt;b&gt;lazy initialization style&lt;/b&gt;, but this time, back with a better way of use lazy implementation. &lt;b&gt;Demon holder idiom &lt;/b&gt;is written by an American computer scientist &lt;a href=&quot;http://en.wikipedia.org/wiki/William_Pugh&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;Bill Pugh&lt;/b&gt;&lt;/a&gt;. The concept with this pattern is to declare and initialize the instance as private static final under a static &lt;b&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2012/01/java-nested-class.html&quot; target=&quot;_blank&quot;&gt;inner class&lt;/a&gt;&lt;/b&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Let’s see with the example class DemandHolderIdiom.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;Example: Class DemandHolderIdiom&lt;/b&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background: #F2F2F2; border: solid windowtext 1.0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div; padding: 1.0pt 1.0pt 1.0pt 1.0pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;package&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;interview.question.java.singleton;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/**&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* The class
DemandHolderIdiom is Singleton Class which implements the Demand&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* Holder &lt;u&gt;Idiom&lt;/u&gt;
style. This class also provides a public method named counter()&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* which will always
returns integer type sequenced counter value.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f9fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;@author&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt; Java Interview Questions
[&lt;a href=&quot;http://interviewquestionjava.blogspot.com/&quot;&gt;http://interviewquestionjava.blogspot.com&lt;/a&gt;]&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;**/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;public class&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;DemandHolderIdiom {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* The integer type counter will hold the value
of the counter. The scope of&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* this field is private, so its only
accessible via the counter method.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* It&#39;s static so that only one copy of this
variable will be available&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* within the memory.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;private static int&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;counter&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; = 0;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* The constructor of the DemandHolderIdiom class
is in private scope so&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* that, no one can initialize this class.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;private&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;DemandHolderIdiom() {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&quot;DemandHolderIdiom.DemandHolderIdiom()&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* The class SingletonInstanceHolder is a
private class which only contains&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* single instance of the class
DemandHolderIdiom&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;private static class&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;SingletonInstanceHolder
{&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* The static private member instance of type
SingletonInstanceHolder&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* Class will hold the single instance of this
class.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;public static final&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;DemandHolderIdiom&amp;nbsp;&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;INSTANCE&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; = &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;new&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;DemandHolderIdiom();&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* The static method getInstance() will return
the only instance of the&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* classDemandHolderIdiom, which is declared
under SingletonInstanceHolder&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* class.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;public static&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;DemandHolderIdiom getInstance()
{&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;return&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;SingletonInstanceHolder.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;INSTANCE&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* This sample method will increase the counter
by 1 and returns its value.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;publicint&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; counter() {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;counter&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;++;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&quot;DemandHolderIdiom.counter()&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;return&lt;/span&gt;&lt;/b&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;counter&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;!--EndFragment--&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Over here, you can see, the instance of the singleton class has been declared and initialized under a static inner class SingletonInstanceHolder. And when &lt;i&gt;getInstance()&lt;/i&gt; is called, it’s the return the instance under the inner class.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;a href=&quot;https://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; name=&quot;domain_holder_idiom_is_lazy_initialization&quot;&gt;&lt;/a&gt;
Now, the question is,&amp;nbsp;&lt;span style=&quot;color: #4488bb;&quot;&gt;&lt;strong&gt;how is Domain Holder Idiom working as lazy initialization style?&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;The answer is, when the class DemandHolderIdiom is loaded, it goes through initialization of only the static fields. Since it doesn’t have any static variable to initialize,&amp;nbsp;SingletonInstanceHolder is not loaded&amp;nbsp;during &lt;b&gt;class loading&lt;/b&gt;.&amp;nbsp;So, when it will initialize? Well, it will only loaded when the &lt;b&gt;JVM&lt;/b&gt; thinks that SingletonInstanceHolder must be executed. And that is only when this inner class has been called from the &lt;i&gt;getInstance()&lt;/i&gt; method for the first time. Now, when this inner class is loaded, all its static variables are also loaded. So the instance is also initialized by executing the private constructor of the outer class. You can also read &lt;b&gt;&lt;a href=&quot;http://docs.oracle.com/javase/specs/jls/se5.0/html/execution.html#12.4&quot; target=&quot;_blank&quot;&gt;Java Language Specification (JLS)&lt;/a&gt;&lt;/b&gt; for more details about class loading and initialization. As the class initialization phase is guaranteed by the JLS to be serial, i.e., non-concurrent, so no further synchronization is required in the static &lt;i&gt;getInstance()&lt;/i&gt; method during loading and initialization.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h4 style=&quot;color: #4488bb;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;
Life cycle:&lt;/span&gt;&lt;/h4&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Initializes during first use.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Destroyed at application shutdown.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h4 style=&quot;color: #4488bb;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;
Pros:&lt;/span&gt;&lt;/h4&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Thread safe.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Lazy loading.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;No need of resource locking to make it thread safe. Thus, performance is also good.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h4 style=&quot;color: #4488bb;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;
Corns:&lt;/span&gt;&lt;/h4&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;No such disadvantage as far. Still, it should be used when you need the lazy loading facility. Else, early loading is simple to understand and use.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;a href=&quot;https://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; name=&quot;enum_singleton_implementation&quot; style=&quot;color: #4488bb;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;
&lt;h2 style=&quot;color: #4488bb;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;
Using enum by Joshua Bloch&lt;/span&gt;&lt;/h2&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Another technique to create singleton is by using Enum. Well Enum is introduced in Java 5, so it’s applicable in java 5 or higher versions. A computer scientist &lt;a href=&quot;http://en.wikipedia.org/wiki/Joshua_Bloch&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;Joshua Bloch&lt;/b&gt;&lt;/a&gt; claims that &quot;a single-element enum type is the best way to implement a singleton&quot; in his book Effective Java [2nd edition]. Enum is thread safe and serialization.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Let’s see an implementation with an enum UsingEnum.&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Example: Enum UsingEnum&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;background: #F2F2F2; border: solid windowtext 1.0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div; padding: 1.0pt 4.0pt 1.0pt 4.0pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #7f0055; font-family: Consolas;&quot;&gt;package&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;interview.question.java.singleton;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;/**&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* The &lt;u&gt;enum&lt;/u&gt;UsingEnum is defined to
behave as Singleton . It also provides a&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* public method named counter() which will
always returns integer type&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* sequenced counter value.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;color: #7f9fbf; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt; Java
Interview Questions [&lt;a href=&quot;http://interviewquestionjava.blogspot.com/&quot;&gt;http://interviewquestionjava.blogspot.com&lt;/a&gt;]&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;**/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #7f0055; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;public enum&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;UsingEnum
{&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;Instance&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*
The integer type counter will hold the value of the counter. The scope of&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*
this field is private, so its only accessible via the counter method.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*
It&#39;s static so that only one copy of this variable will be available&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*
within the memory.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;private static int&amp;nbsp;&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;counter&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; = 0;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*
This sample method will increase the counter by 1 and returns its value.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;public int&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; counter()
{&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;counter&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;++;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&quot;UsingEnum.counter()&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;return&amp;nbsp;&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;counter&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Here, you can see the code is very simple.&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background: #F2F2F2; border: solid windowtext 1.0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div; padding: 1.0pt 4.0pt 1.0pt 4.0pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;public
enum &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;UsingEnum {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;Instance&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;By this only your singleton is created. So, don’t even need any locking for thread safety. Enum also supports serialization. But it is unable to extend any class &lt;b&gt;&lt;i&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2012/02/java-why-cant-enum-extends-any-other.html&quot; target=&quot;_blank&quot;&gt;[read more for details]&lt;/a&gt;&lt;/i&gt;&lt;/b&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;h4 style=&quot;color: #4488bb;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;
Life cycle:&lt;/span&gt;&lt;/h4&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Initializes during first use.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Destroyed at application shutdown.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;h4 style=&quot;color: #4488bb;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;
Pros:&lt;/span&gt;&lt;/h4&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Thread safe.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Supports serialization.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;No locking is needed, so performance is better.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Code simplicity.&lt;/span&gt;&lt;br /&gt;
&lt;h4 style=&quot;color: #4488bb;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;
Corns:&lt;/span&gt;&lt;/h4&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Available from java 5&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Unable to extend any class.&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h2&gt;
&lt;/h2&gt;
&lt;h3 style=&quot;color: #4488dd;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;
Test Class to execute all Singleton Examples&lt;/span&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Now, it’s time to test the all above singleton classes. For
that, we have a Test class, which simple calls all the above classes twice, to
see if its initializing once or more, by using a loop.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: #F2F2F2; border: solid windowtext 1.0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div; padding: 1.0pt 1.0pt 1.0pt 1.0pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;package&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;interview.question.java.singleton;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;/**&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* The class Test will
call all the singleton classes to test.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f9fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;@author&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt; Java Interview Questions
[&lt;a href=&quot;http://interviewquestionjava.blogspot.com/&quot;&gt;http://interviewquestionjava.blogspot.com&lt;/a&gt;]&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;**/&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;public class&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; Test {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;public static void&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; main(String[]
args) {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;for&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt; (&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;int&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;i = 0; i&amp;lt; 2; i++) {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;//LasyInitializationThreadUnsafe&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LasyInitializationThreadUnsafelasyInitializationSingleThread
= LasyInitializationThreadUnsafe&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;i&gt;getInstance&lt;/i&gt;();&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;.println(lasyInitializationSingleThread.counter());&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;//LasyInitializationThreadSafe&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LasyInitializationThreadSafelasyInitializationThreadSafe
= LasyInitializationThreadSafe&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;i&gt;getInstance&lt;/i&gt;();&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;.println(lasyInitializationThreadSafe.counter());&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;//DoubleCheckLock&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DoubleCheckLockdoubleCheckLock
= DoubleCheckLock.&lt;i&gt;getInstance&lt;/i&gt;();&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;.println(doubleCheckLock.counter());&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;//EagerInitialization&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EagerInitializationeagerInitialization
= EagerInitialization&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;i&gt;getInstance&lt;/i&gt;();&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;.println(eagerInitialization.counter());&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;//StaticBlockInitialization&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; StaticBlockInitializationstaticBlockInitialization
= StaticBlockInitialization&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;i&gt;getInstance&lt;/i&gt;();&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;.println(staticBlockInitialization.counter());&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;//DemandHolderIdiom&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DemandHolderIdiomdemandHolderIdiom
= DemandHolderIdiom&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;i&gt;getInstance&lt;/i&gt;();&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;.println(demandHolderIdiom.counter());&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;//UsingEnum&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;.println(UsingEnum.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;Instance&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;.counter());&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&quot;\n\n&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 8.0pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Output:&lt;/span&gt;&lt;/h4&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Now, from the output it’s clear that, all the singleton
classes have been initialized for one time.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: #EAE7DB; border: solid windowtext 1.0pt; mso-background-themecolor: accent6; mso-background-themetint: 51; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div; padding: 1.0pt 4.0pt 1.0pt 4.0pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;LasyInitializationThreadUnsafe.LasyInitializationThreadUnsafe()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;LasyInitializationThreadUnsafe.counter()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;LasyInitializationThreadSafe.LasyInitializationThreadSafe()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;LasyInitializationThreadSafe.counter()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;DoubleCheckLock.DoubleCheckLock()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;DoubleCheckLock.counter()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;EagerInitialization.EagerInitialization()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;EagerInitialization.counter()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;StaticBlockInitialization.StaticBlockInitialization()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;StaticBlockInitialization.counter()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;DemandHolderIdiom.DemandHolderIdiom()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;DemandHolderIdiom.counter()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;UsingEnum.counter()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;LasyInitializationThreadUnsafe.counter()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;LasyInitializationThreadSafe.counter()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;DoubleCheckLock.counter()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;EagerInitialization.counter()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;StaticBlockInitialization.counter()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;DemandHolderIdiom.counter()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;UsingEnum.counter()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 8pt;&quot;&gt;2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;h2 style=&quot;color: #4488dd;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Conclusion&lt;/span&gt;&lt;/h2&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Well, after discussing all the implementation styles, we may think the &lt;b&gt;&lt;i&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2014/02/java-singleton-pattern-concept-and.html#enum_singleton_implementation&quot;&gt;Enum Singleton Style&lt;/a&gt;&lt;/i&gt;&lt;/b&gt; and&amp;nbsp;&lt;span style=&quot;text-align: center;&quot;&gt;&lt;i style=&quot;font-weight: bold;&quot;&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2014/02/java-singleton-pattern-concept-and.html#demand_holder_idiom&quot;&gt;Domain Holder Idiom&lt;/a&gt;&lt;/i&gt;&amp;nbsp;are the most smarter ways to implement Singleton pattern in java. But that doesn&#39;t mean other styles are&amp;nbsp;irrelevant. Styles like &lt;b&gt;&lt;i&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2014/02/java-singleton-pattern-concept-and.html#simple_lazy_initialization&quot;&gt;Simple Lazy Initialization Style&lt;/a&gt;&lt;/i&gt;&lt;/b&gt; and&lt;b&gt; &lt;i&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2014/02/java-singleton-pattern-concept-and.html#eagar_initialization&quot;&gt;Early Initialization&lt;/a&gt;&lt;/i&gt;&lt;/b&gt; are very good for&amp;nbsp;learning&amp;nbsp;phase.&amp;nbsp;&amp;nbsp;Because you can get the concept and structure of a singleton class very clearly form these patterns. And remember &lt;b&gt;&lt;i&gt;java.lang.Runtime&lt;/i&gt;&lt;/b&gt; uses &lt;b&gt;&lt;i&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2014/02/java-singleton-pattern-concept-and.html#eagar_initialization&quot;&gt;Early Initialization&lt;/a&gt;&lt;/i&gt;&lt;/b&gt; too.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif; text-align: center;&quot;&gt;&lt;b&gt;&lt;i&gt;Therefore, when it comes to Singleton Implementation style, choose wisely and code smartly.&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;
&lt;/span&gt;

&lt;a href=&quot;https://plus.google.com/+AnijitSarkar?rel=author&quot; class=&quot;auth_style&quot;&gt;Anijit Sarkar&lt;/a&gt;
&lt;/div&gt;</description><link>http://interviewquestionjava.blogspot.com/2014/02/java-singleton-pattern-concept-and.html</link><author>noreply@blogger.com (Anijit Sarkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8555Iva9OiTc0ZP7U5dx82rGuSMB3WB_MOTR7ygXt1EgLnEmiDxB0zb1uTVQtFEVWf0zgoXiBAlESAolLf6n9Pi-GR6cZd42J36pl5flT8ZRmhg1AP0Ca7F2neaeZ2E5Lu0kAE9Sggug/s72-c/Singleton-structure.JPG" height="72" width="72"/><thr:total>240</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3166332459178575831.post-3492928496103998546</guid><pubDate>Mon, 13 Jan 2014 21:26:00 +0000</pubDate><atom:updated>2014-01-14T03:19:53.755+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">FRAMEWORK</category><category domain="http://www.blogger.com/atom/ns#">FRAMEWORK INTERVIEW QUESTIONS</category><category domain="http://www.blogger.com/atom/ns#">HIBERNATE</category><category domain="http://www.blogger.com/atom/ns#">HIBERNATE INTERVIEW QUESTIONS</category><title>FRAMEWORK: ORM – Object Relational Mapping</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;b&gt;ORM&lt;/b&gt; (&lt;b&gt;Object Relational Mapping&lt;/b&gt;) is a programming concept of a mapping between &lt;b&gt;Object Oriented Programming&lt;/b&gt; and &lt;b&gt;Relational Database&lt;/b&gt;. It’s the technique to frame the components of Relational Database to Object Oriented Programming, to do CRUD operations. It creates an object oriented representation of a relational database, so that developers can push or pop data to database as an object.&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; Databases are designed on the basis of &lt;b&gt;Mathematical principle&lt;/b&gt; where as &lt;b&gt;programming languages&lt;/b&gt; like &lt;b&gt;Java, C++, C#&lt;/b&gt; are based on &lt;b&gt;Object Oriented Programming principle&lt;/b&gt;. &lt;b&gt;Objects&lt;/b&gt; have &lt;b&gt;behavior&lt;/b&gt; and &lt;b&gt;attribute&lt;/b&gt;, it’s good on &lt;b&gt;business modeling&lt;/b&gt; where on the other hand database is only deals with &lt;b&gt;large amount of data&lt;/b&gt;. Now due to this conceptual deference, in real life scenario, &lt;b&gt;database transactions&lt;/b&gt; become unmanageable, when we are dealing with large amount of data transaction. So to bridge this difference, &lt;b&gt;ORM&lt;/b&gt; is introduced. It’s the process of mapping tables to class objects, so that data transactions could be easier.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Pros:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Create classes replicating database tables, in programming language side, so that programs can interacts with objects not direct tables.&lt;/li&gt;
&lt;li&gt;Provides &lt;a href=&quot;http://interviewquestionjava.blogspot.com/2012/01/what-is-java-api.html&quot; target=&quot;_blank&quot;&gt;API&lt;/a&gt;s for normal &lt;b&gt;CRUD &lt;/b&gt;(Create Read Update Delete) operations, so no need to write queries for that.&lt;/li&gt;
&lt;li&gt;Some provides query language which is database independent.&lt;/li&gt;
&lt;li&gt;Provision to interact with multiple databases.&lt;/li&gt;
&lt;li&gt;Helps to manage business logic easily when dealing with big amount of data, and lots of database transaction.&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Corns:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;No need to use when your application doesn&#39;t involve much database interaction.&lt;/li&gt;
&lt;li&gt;Little bit heavier than native database connectivity.&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiP7mJE2vyuJvXhNVN5PNP6BamKeQntM9AkKdBAS8DZ-2pWLkZo7a9kNzvUe_wH6rYNJJ2CUCzKwOjAzHjZOwcqOCDV9FBr2kof-lHvW8vFAF_dgYZEvj8WgQ3rjYR4uMqacrpItahAtFU/s1600/object_relational_mapping.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Object Relational Mapping&quot; border=&quot;0&quot; height=&quot;304&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiP7mJE2vyuJvXhNVN5PNP6BamKeQntM9AkKdBAS8DZ-2pWLkZo7a9kNzvUe_wH6rYNJJ2CUCzKwOjAzHjZOwcqOCDV9FBr2kof-lHvW8vFAF_dgYZEvj8WgQ3rjYR4uMqacrpItahAtFU/s640/object_relational_mapping.JPG&quot; title=&quot;Object Relational Mapping&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://interviewquestionjava.blogspot.com/2014/01/framework-orm-object-relational-mapping.html</link><author>noreply@blogger.com (Anijit Sarkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiP7mJE2vyuJvXhNVN5PNP6BamKeQntM9AkKdBAS8DZ-2pWLkZo7a9kNzvUe_wH6rYNJJ2CUCzKwOjAzHjZOwcqOCDV9FBr2kof-lHvW8vFAF_dgYZEvj8WgQ3rjYR4uMqacrpItahAtFU/s72-c/object_relational_mapping.JPG" height="72" width="72"/><thr:total>219</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3166332459178575831.post-5095568277875222904</guid><pubDate>Fri, 10 Jan 2014 21:43:00 +0000</pubDate><atom:updated>2014-02-13T13:14:18.487+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">JAVA</category><category domain="http://www.blogger.com/atom/ns#">JAVA INTERVIEW QUESTIONS</category><title>JAVA: Data Types Conversion Chart</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; In &lt;b&gt;Java Programming Language&lt;/b&gt;, we must declare a variable name and type, before using it. The &lt;b&gt;data type&lt;/b&gt; of a variable defines the the type of value it will contain. &lt;b&gt;Java supports total 8 types of primitive data types&lt;/b&gt;. The name of this data types are all reserved as keywords.&lt;br /&gt;
Among which, 1) &lt;b&gt;byte&lt;/b&gt;, 2) &lt;b&gt;short&lt;/b&gt;, 3) &lt;b&gt;int&lt;/b&gt; &amp;amp; 4) &lt;b&gt;long&lt;/b&gt; can store integer values of different range.&lt;br /&gt;
5) &lt;b&gt;float&lt;/b&gt; and 6) &lt;b&gt;double&lt;/b&gt; can store floating numbers of different range.&lt;br /&gt;
7) &lt;b&gt;boolean&lt;/b&gt; &amp;nbsp;can store only true/false. It is used as flag, to perform boolean operation.&lt;br /&gt;
8) &lt;b&gt;char&lt;/b&gt; can store a single 16-bit Unicode character of range from &#39;\u0000&#39; (0) to &#39;\uffff&#39; (65,535).&lt;br /&gt;
Apart from these, Java also provides a &lt;b&gt;String &lt;/b&gt;data type which is defined as a Class (java.lang.String). It can contains alpha numeric values.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAuJ76cd2IgFxU_nWAvo3LcZ5qwQ2aoNPYVnV2IImepzQZKRyRRaChoa_AfwR74GG_EaTgikqAxd4dyx4PA0NNRhaFuE0Fub42z_Gler2nUvhTptFikNGr3G7EMhY1JLgKT_hg6Q_ZhYU/s1600/java_data_type_conversion_chart.bmp&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; margin-bottom: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;302&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAuJ76cd2IgFxU_nWAvo3LcZ5qwQ2aoNPYVnV2IImepzQZKRyRRaChoa_AfwR74GG_EaTgikqAxd4dyx4PA0NNRhaFuE0Fub42z_Gler2nUvhTptFikNGr3G7EMhY1JLgKT_hg6Q_ZhYU/s1600/java_data_type_conversion_chart.bmp&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;byte&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;b&gt;Type: &lt;/b&gt;Integer (8-bit signed two&#39;s complement integer).&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Range: &amp;nbsp;&lt;/b&gt;from -128 [-2^(8-1)] to 127 [(2^(8-1))-1].&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Memory: &lt;/b&gt;1 byte&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Default Value : &lt;/b&gt;0&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Example: &lt;/b&gt;byte b = 0;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;b&gt;short&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Type:&amp;nbsp;&lt;/b&gt;Integer (16-bit signed two&#39;s complement integer).&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Range: &amp;nbsp;&lt;/b&gt;from -32768&amp;nbsp;[-2^(16-1)]&amp;nbsp;to 32767&amp;nbsp;[(2^(16-1))-1].&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Memory: &lt;/b&gt;2&amp;nbsp;bytes&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Default&amp;nbsp;Value :&amp;nbsp;&lt;/b&gt;0&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Example: &lt;/b&gt;short s&amp;nbsp;&amp;nbsp;= 0;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;b&gt;int&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Type:&amp;nbsp;&lt;/b&gt;Integer (32-bit signed two&#39;s complement integer).&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Range: &amp;nbsp;&lt;/b&gt;from -2147483648&amp;nbsp;[-2^(32-1)]&amp;nbsp;to&amp;nbsp;2147483647&amp;nbsp;[(2^(32-1))-1].&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Memory:&amp;nbsp;&lt;/b&gt;4 bytes&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Default&amp;nbsp;Value :&amp;nbsp;&lt;/b&gt;0&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Example: &lt;/b&gt;int i&amp;nbsp;= 0;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;long&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Type:&amp;nbsp;&lt;/b&gt;Integer (64-bit signed two&#39;s complement integer).&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Range: &amp;nbsp;&lt;/b&gt;from -9223372036854775808&amp;nbsp;[-2^(64-1)]&amp;nbsp;to 9223372036854775807&amp;nbsp;[(2^(64-1))-1].&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Memory:&amp;nbsp;&lt;/b&gt;8 bytes&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Default&amp;nbsp;Value :&amp;nbsp;&lt;/b&gt;0L&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Example: &lt;/b&gt;long l&amp;nbsp;= 0L;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;float&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Type: &lt;/b&gt;Float (Single precision 32-bit IEEE 754 floating point).&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Range: &amp;nbsp;&lt;/b&gt;from 1.4E-45F to 3.4028235E+38F.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Memory: &lt;/b&gt;4&amp;nbsp;bytes&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Default&amp;nbsp;Value :&amp;nbsp;&lt;/b&gt;0.0f&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Example: &lt;/b&gt;float f&amp;nbsp;= 0f;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;double&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Type:&amp;nbsp;&lt;/b&gt;Float (Single precision 64-bit IEEE 754 floating point).&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Range: &amp;nbsp;&lt;/b&gt;from 4.9E-324D&amp;nbsp;to 1.7976931348623157E+308D.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Memory: &lt;/b&gt;8&amp;nbsp;bytes&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Default&amp;nbsp;Value&lt;/b&gt;&lt;b&gt;&amp;nbsp;:&amp;nbsp;&lt;/b&gt;0.0d&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Example: &lt;/b&gt;double d&amp;nbsp;= 0d;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;boolean&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Type: &lt;/b&gt;boolean (boolean flag - true / false).&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Range: &amp;nbsp;&lt;/b&gt;NA.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Memory:&amp;nbsp;&lt;/b&gt;virtual machine dependent&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Default&amp;nbsp;Value : &lt;/b&gt;false&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Example:&amp;nbsp;&lt;/b&gt;boolean b = false;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;char&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Type: &lt;/b&gt;Character&amp;nbsp;(a single&amp;nbsp;16-bit Unicode character).&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Range: &amp;nbsp;&lt;/b&gt;from&amp;nbsp;&#39;\u0000&#39; (0) to &#39;\uffff&#39; (65535).&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Memory: &lt;/b&gt;2&amp;nbsp;bytes&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Default&amp;nbsp;Value : &#39;&lt;/b&gt;\u0000&#39;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Example: &lt;/b&gt;char c = &#39;\u0000&#39;;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;String&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Type:&amp;nbsp;&lt;/b&gt;String Character (a class can store alpha numeric value).&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Range: &amp;nbsp;&lt;/b&gt;NA&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Memory:&amp;nbsp;&lt;/b&gt;NA&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Default&amp;nbsp;Value : &lt;/b&gt;null&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Example:&amp;nbsp;&lt;/b&gt;String s = &quot;Hello World&quot;;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAuJ76cd2IgFxU_nWAvo3LcZ5qwQ2aoNPYVnV2IImepzQZKRyRRaChoa_AfwR74GG_EaTgikqAxd4dyx4PA0NNRhaFuE0Fub42z_Gler2nUvhTptFikNGr3G7EMhY1JLgKT_hg6Q_ZhYU/s1600/java_data_type_conversion_chart.bmp&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;

&lt;a href=&quot;https://plus.google.com/+AnijitSarkar?rel=author&quot; class=&quot;auth_style&quot;&gt;Anijit Sarkar&lt;/a&gt;
&lt;/div&gt;</description><link>http://interviewquestionjava.blogspot.com/2014/01/java-data-types-conversion-chart.html</link><author>noreply@blogger.com (Anijit Sarkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAuJ76cd2IgFxU_nWAvo3LcZ5qwQ2aoNPYVnV2IImepzQZKRyRRaChoa_AfwR74GG_EaTgikqAxd4dyx4PA0NNRhaFuE0Fub42z_Gler2nUvhTptFikNGr3G7EMhY1JLgKT_hg6Q_ZhYU/s72-c/java_data_type_conversion_chart.bmp" height="72" width="72"/><thr:total>164</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3166332459178575831.post-2970173268853982419</guid><pubDate>Sun, 15 Sep 2013 20:54:00 +0000</pubDate><atom:updated>2013-09-16T02:24:43.728+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">JAVA</category><category domain="http://www.blogger.com/atom/ns#">JAVA INTERVIEW QUESTIONS</category><title>JAVA: Overloading and Overriding</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
Overloading: &amp;nbsp;&lt;/h3&gt;
&lt;br /&gt;
&amp;nbsp; &lt;b&gt;Overloading &lt;/b&gt;is a popular technique of &lt;b&gt;object oriented programming&lt;/b&gt;. It allows you to define a &lt;b&gt;method &lt;/b&gt;with same name but with different &lt;b&gt;parameters &lt;/b&gt;list.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiL1svChSiDXA8GIGKVT6oDuCd-EcAtUztnfrD2n3SEWQYajGJ1irfIBc_0Sh-I3A2OXPDIj4PeV5OXXixEK6IlbBhbYmP92-iSuQf0aBEVyszNgveVyv76H4APnurz_0DHM_HJUStEqQc/s1600/Java1.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiL1svChSiDXA8GIGKVT6oDuCd-EcAtUztnfrD2n3SEWQYajGJ1irfIBc_0Sh-I3A2OXPDIj4PeV5OXXixEK6IlbBhbYmP92-iSuQf0aBEVyszNgveVyv76H4APnurz_0DHM_HJUStEqQc/s200/Java1.png&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;b&gt;Java &lt;/b&gt;identifies method by its name and signature. So, if the combination of method name and signature is unique, the &lt;b&gt;compiler &lt;/b&gt;doesn’t have any issue to identify it. When you use &lt;b&gt;overloaded methods&lt;/b&gt;, the &lt;b&gt;java&lt;/b&gt; &lt;b&gt;compile &lt;/b&gt;will automatically identifies the right version of the method by number and/or types of &lt;b&gt;passing parameters&lt;/b&gt;. But you can’t declare more than one method with same name and &lt;b&gt;passing parameters&lt;/b&gt;. The &lt;b&gt;compiler &lt;/b&gt;doesn’t consider &lt;b&gt;return types&lt;/b&gt; when validating uniqueness of a method. That means you can’t have two &lt;b&gt;methods &lt;/b&gt;with same name and &lt;b&gt;passing parameters&lt;/b&gt; with different &lt;b&gt;return type&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;b&gt;Java &lt;/b&gt;allows both &lt;b&gt;method&lt;/b&gt; and &lt;b&gt;constructor overloading&lt;/b&gt;. Let’s see this with an example.&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Code:&lt;/h4&gt;
&lt;div&gt;
&lt;div style=&quot;background: #BFBFBF; border: solid windowtext 1.0pt; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div; padding: 1.0pt 1.0pt 1.0pt 1.0pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;package&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;
com.interview.question.java;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;class&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; OverloadingDemo
{&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;/**&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * This class demonstrates overloading in
java&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f9fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;@author&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;
http://interviewquestionjava.blogspot.com&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; **/&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;private&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;int&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;/* constructor overloading */&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;
OverloadingDemo(){&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;
OverloadingDemo(&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;int&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; a){&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;this&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; = a;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;/* method overloading */&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;int&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; add(&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;int&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; num){&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; +=num;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;return&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;int&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; add(String
str){&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;+= Integer.&lt;i&gt;valueOf&lt;/i&gt;(str);&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;return&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;int&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; add(&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;int&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; num1, &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;int&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; num2){&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; += num1;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; += num2;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;return&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;/* test overloading */&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;static&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;void&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; main(String[]
args) {&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OverloadingDemo objOverloadingDemo1
= &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;new&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;
OverloadingDemo();&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OverloadingDemo objOverloadingDemo2
= &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;new&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;
OverloadingDemo(5);&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;.println(objOverloadingDemo1.add(5));&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;.println(objOverloadingDemo1.add(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&quot;3&quot;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;));&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;.println(objOverloadingDemo1.add(3,
5));&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&quot;-----&quot;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;.println(objOverloadingDemo2.add(5));&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;.println(objOverloadingDemo2.add(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&quot;3&quot;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;));&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;.println(objOverloadingDemo2.add(3,
5));&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Output:&lt;/h4&gt;
&lt;div&gt;
&lt;div style=&quot;background: #B2A1C7; border: solid windowtext 1.0pt; mso-background-themecolor: accent4; mso-background-themetint: 153; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div; padding: 1.0pt 4.0pt 1.0pt 4.0pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;16&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;-----&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;13&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;21&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp;Here, in this class &lt;b&gt;OverloadingDemo&lt;/b&gt; we defined two &lt;b&gt;constructors&lt;/b&gt; with different signatures, and three &lt;b&gt;methods&lt;/b&gt; with same name but different number and/or types of &lt;b&gt;passing parameters&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
Overriding:&lt;/h3&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;b&gt;Overriding &lt;/b&gt;is the &lt;b&gt;technique &lt;/b&gt;of &lt;b&gt;inheriting &lt;/b&gt;a class and redefining the behaviors of the super class. That means, when you define a method in subclass with the same signature (name, plus the number and the type of its parameters) and return type as in the superclass, then you are overriding the method of the superclass in your subclass, and the technique is known as method overriding.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1Yo7_qBnEWA0F76YGHPX78_7gXzbt0w2dVO79cKsuRzo8J_mPKm0G1Mvg7HED1MbIzBnx0nd8QIDY2mhGQJRak16WpsvIoA-2zchABNyQ0-g60lbnTqpNYSYU3UNuyON0k2Mjs1vvSWw/s1600/Java6.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1Yo7_qBnEWA0F76YGHPX78_7gXzbt0w2dVO79cKsuRzo8J_mPKm0G1Mvg7HED1MbIzBnx0nd8QIDY2mhGQJRak16WpsvIoA-2zchABNyQ0-g60lbnTqpNYSYU3UNuyON0k2Mjs1vvSWw/s200/Java6.png&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;In &lt;a href=&quot;http://interviewquestionjava.blogspot.com/2012/01/what-is-method-overriding.html&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;method overriding&lt;/b&gt;&lt;/a&gt;, method name, method input parameters and return types in subclass should be same in &lt;b&gt;superclass&lt;/b&gt;. &amp;nbsp;It can only modify the behaviors. It can return a &lt;b&gt;subtype &lt;/b&gt;of the original &lt;b&gt;return type&lt;/b&gt; defined in superclass, and this technique is known as &lt;b&gt;covariant return type&lt;/b&gt; &lt;i&gt;[Java 1.5 or above support this]&lt;/i&gt;. For example, suppose the return type in superclass is&lt;b&gt; java.util.Map&lt;/b&gt;, you can change it to &lt;b&gt;java.util.HashMap&lt;/b&gt; in subclass, as &lt;b&gt;HashMap &lt;/b&gt;is a subtype of &lt;b&gt;Map&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;You can also use &lt;b&gt;&lt;i&gt;@Override annotation&lt;/i&gt;&lt;/b&gt; &lt;i&gt;[which is available in Java 1.5 or above]&lt;/i&gt; to tell the &lt;b&gt;compiler &lt;/b&gt;that you are trying to override a method in the superclass. And, fof any reason, if the compile is unable to detect that method, it will generate an error.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; In &lt;b&gt;method overriding&lt;/b&gt; in &lt;b&gt;java&lt;/b&gt;, you can level up the &lt;b&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2012/01/access-modifiers-in-java.html&quot; target=&quot;_blank&quot;&gt;access&lt;/a&gt;&lt;/b&gt; level but you can’t level it down. That means, if a &lt;b&gt;method &lt;/b&gt;is declared as &lt;b&gt;protected &lt;/b&gt;in superclass, it can be set as &lt;b&gt;public &lt;/b&gt;is subclass but not as &lt;b&gt;private&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If a method is declared as &lt;b&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2012/01/what-is-final.html&quot; target=&quot;_blank&quot;&gt;final&lt;/a&gt;&lt;/b&gt;, it can’t be &lt;b&gt;overridden&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
Now let’s see with an example.&lt;br /&gt;
&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Code:&lt;/h4&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Super Class :&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background: #BFBFBF; border: solid windowtext 1.0pt; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div; padding: 1.0pt 4.0pt 1.0pt 4.0pt;&quot;&gt;

&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;package&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;
com.interview.question.java;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;import&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;
java.util.HashMap;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;import&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; java.util.Map;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;class&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; SuperClass {&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;/**&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * This is a sample class&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f9fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;@author&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;
http://interviewquestionjava.blogspot.com&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; **/&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;/* the return type of this method is
Map and in subclass it will be changed to HashMap */&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;u&gt;Map&lt;/u&gt;
methodForcovariant(){&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;u&gt;Map&lt;/u&gt; map = &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;new&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;u&gt;HashMap&lt;/u&gt;();&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;return&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; map;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;/* sample method which &lt;u&gt;willbe&lt;/u&gt;
overridden in subclass */&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;void&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;span style=&quot;background: silver; mso-highlight: silver;&quot;&gt;sampleMethod&lt;/span&gt;(){&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&quot;SuperClass.sampleMethod()&quot;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;/* the specifier of this method &lt;u&gt;willbe&lt;/u&gt;
changed to public from protected in its subclass */&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;protected&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;void&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;
protectedMethod(){&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&quot;SuperClass.protectedMethod()&quot;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;/* this method can&#39;t be overridden as
it&#39;s declare as final */&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;final&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;void&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; finalMethod(){&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&quot;SuperClass.finalMethod()&quot;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;o:p&gt;Sub Class:&lt;/o:p&gt;&lt;/h4&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;o:p&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background: #BFBFBF; border: solid windowtext 1.0pt; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div; padding: 1.0pt 1.0pt 1.0pt 1.0pt;&quot;&gt;

&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;package&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;
com.interview.question.java;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;import&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;
java.util.HashMap;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;import&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;u&gt;java.util.Map&lt;/u&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;class&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; OverridingDemo &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;extends&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; SuperClass{&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;/**&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
*&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
* This class demonstrates overriding by extending SuperClass &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
*&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
* &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f9fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;@author&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt; http://interviewquestionjava.blogspot.com&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
*&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
**/&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;/* Overriding with &lt;u&gt;covariant&lt;/u&gt;
return type : &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* the return type of this method is modified
to its &lt;u&gt;subtype&lt;/u&gt; which is allowed in method overriding */&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #646464; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;@Override&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;u&gt;HashMap&lt;/u&gt; methodForcovariant(){&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;u&gt;HashMap&lt;/u&gt; hmp = &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;new&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;u&gt;HashMap&lt;/u&gt;();&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;return&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; hmp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;/* Overriding:&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* overriding the method
SuperClass.sampleMethod() */&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #646464; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;@Override&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;void&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; sampleMethod(){&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&quot;OverridingDemo.sampleMethod()&quot;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
}&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;/* Overriding access specifier:&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* the specifier of this method is changed to
public from protected */&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #646464; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;@Override&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;void&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; protectedMethod(){&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&quot;OverridingDemo.protectedMethod()&quot;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
}&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;static&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;void&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; main(String[]
args) {&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SuperClass objSuperClass = &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;new&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; SuperClass(); &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SuperClass objOverridingDemo =
&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;new&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;
OverridingDemo(); &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objSuperClass.sampleMethod();&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objOverridingDemo.sampleMethod();&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;o:p&gt;Output:&lt;/o:p&gt;&lt;/h4&gt;
&lt;div&gt;
&lt;o:p&gt;

&lt;div style=&quot;background: #B2A1C7; border: solid windowtext 1.0pt; mso-background-themecolor: accent4; mso-background-themetint: 153; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div; padding: 1.0pt 4.0pt 1.0pt 4.0pt;&quot;&gt;

&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;SuperClass.sampleMethod()&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;OverridingDemo.sampleMethod()&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/o:p&gt;&lt;/div&gt;
&lt;div&gt;
&lt;o:p&gt;&lt;div&gt;
Here, we have used 4 methods:&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;i&gt;methodForcovariant()&lt;/i&gt;&lt;/b&gt; – it shows the change of return type to its subtype during method overriding.&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;i&gt;sampleMethod()&lt;/i&gt;&lt;/b&gt; – it shows method overriding in normal way.&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;i&gt;protectedMethod()&lt;/i&gt;&lt;/b&gt; – it shows method overriding by leveling up&lt;b&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2012/01/access-modifiers-in-java.html&quot; target=&quot;_blank&quot;&gt; access specifiers&lt;/a&gt;&lt;/b&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;i&gt;finalMethod()&lt;/i&gt;&lt;/b&gt; – it shows we can’t override methods declared as &lt;a href=&quot;http://interviewquestionjava.blogspot.com/2012/01/what-is-final.html&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;final&lt;/b&gt;&lt;/a&gt;.&lt;/div&gt;
&lt;/o:p&gt;&lt;/div&gt;
&lt;/o:p&gt;&lt;/div&gt;
&lt;div&gt;
&lt;o:p&gt;&lt;br /&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div&gt;
&lt;o:p&gt;&lt;br /&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://interviewquestionjava.blogspot.com/2013/09/java-overloading-and-overriding.html</link><author>noreply@blogger.com (Anijit Sarkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiL1svChSiDXA8GIGKVT6oDuCd-EcAtUztnfrD2n3SEWQYajGJ1irfIBc_0Sh-I3A2OXPDIj4PeV5OXXixEK6IlbBhbYmP92-iSuQf0aBEVyszNgveVyv76H4APnurz_0DHM_HJUStEqQc/s72-c/Java1.png" height="72" width="72"/><thr:total>11</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3166332459178575831.post-2972600511424584762</guid><pubDate>Tue, 13 Aug 2013 20:58:00 +0000</pubDate><atom:updated>2014-02-10T17:50:17.510+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">JAVA</category><category domain="http://www.blogger.com/atom/ns#">JAVA INTERVIEW QUESTIONS</category><title>JAVA: Deserializing an Object from File</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUxDPbOlDsk8KlydHPv5SnJPzF-pvJKOL1bV5wSgAnVi_rHyeWcDEiJPeb0AzDs-qcqpeh36XHLXfwREJCXAe16L1Brml1ef_2z3TembQakuwEHgkiN94QGpr24Ca5yrCbLXYfBSDXOT8/s1600/java.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em; text-align: left;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUxDPbOlDsk8KlydHPv5SnJPzF-pvJKOL1bV5wSgAnVi_rHyeWcDEiJPeb0AzDs-qcqpeh36XHLXfwREJCXAe16L1Brml1ef_2z3TembQakuwEHgkiN94QGpr24Ca5yrCbLXYfBSDXOT8/s200/java.png&quot; height=&quot;200&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; To &lt;b&gt;deserialize an object from file&lt;/b&gt;, first get the serialized data from the file using&amp;nbsp;&lt;b&gt;FileInputStream&lt;/b&gt;. In case if you want to know how to serialize an object to file please check this article &lt;b&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2012/01/java-how-to-serialize-object-to-file.html&quot; target=&quot;_blank&quot;&gt;serialize an object to a file&lt;/a&gt;&lt;/b&gt;. Pass the&amp;nbsp;FileInputStream object through&amp;nbsp;&lt;b&gt;ObjectInputStream&lt;/b&gt;. Now, get the object from&amp;nbsp;&lt;b&gt;ObjectInputStream &lt;/b&gt;using the API&lt;b&gt;&amp;nbsp;readObject()&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Suppose we have a file named &lt;b&gt;sampleClass.ser&lt;/b&gt; which contains the data of a serialized object of class &lt;b&gt;SampleClass&lt;/b&gt;. Please check this &lt;a href=&quot;http://interviewquestionjava.blogspot.com/2012/01/java-how-to-serialize-object-to-file.html&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;post &lt;/b&gt;&lt;/a&gt;to create this file. Where SampleClass is a normal &lt;b&gt;pojo &lt;/b&gt;class with 4 variables, among which 1 is declared as &lt;b&gt;transient&lt;/b&gt;, that means, protected from &lt;b&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2012/01/java-what-is-serialization.html&quot; target=&quot;_blank&quot;&gt;serialization&lt;/a&gt;&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; border: 0px; font-family: Arial, Helvetica, sans-serif; line-height: 14px; margin: 0px; padding: 0px;&quot;&gt;Class&amp;nbsp;SampleClass :&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background: #D9D9D9; border: solid windowtext 1.0pt; mso-background-themecolor: background1; mso-background-themeshade: 217; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div; padding: 1.0pt 1.0pt 1.0pt 1.0pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;package&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;
com.interview.question.java;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;class&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; SampleClass &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;implements&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;
java.io.Serializable{&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;/**&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Sample serialized class.&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f9fbf; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;@author&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;
http://interviewquestionjava.blogspot.com&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; **/&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;private&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;static&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;final&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;long&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;serialVersionUID&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; = 1L;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;private&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; String &lt;/span&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;strName&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;private&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; String &lt;/span&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;strAddress&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;private&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; String &lt;/span&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;strUsername&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;/**&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*
we declared the variable strPassword as transient. &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*
So, it will be shield from serialization.&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;**/&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;private&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;transient&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; String &lt;/span&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;strPassword&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; String
getStrName() {&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;return&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;strName&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;void&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;
setStrName(String strName) {&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;this&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;strName&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; = strName;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; String
getStrAddress() {&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;return&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;strAddress&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;void&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;
setStrAddress(String strAddress) {&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;this&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;strAddress&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; = strAddress;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; String
getStrUsername() {&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;return&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;strUsername&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;void&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;
setStrUsername(String strUsername) {&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;this&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;strUsername&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; = strUsername;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; String
getStrPassword() {&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;return&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;strPassword&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;void&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;
setStrPassword(String strPassword) {&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;this&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;strPassword&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; = strPassword;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0in;&quot;&gt;
&amp;nbsp;Now, during &lt;b&gt;serialization &lt;/b&gt;of the object of this &lt;b&gt;SampleClass&lt;/b&gt;, we set the following values.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background: #D9D9D9; border: solid windowtext 1.0pt; mso-background-themecolor: background1; mso-background-themeshade: 217; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div; padding: 1.0pt 4.0pt 1.0pt 4.0pt;&quot;&gt;
&lt;div style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin: 0in 0in 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp; objSampleClass.setStrName(&lt;/span&gt;&lt;span style=&quot;color: #073763; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&quot;Ashoka Maurya&quot;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin: 0in 0in 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;
objSampleClass.setStrAddress(&lt;/span&gt;&lt;span style=&quot;color: #073763; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&quot;Magadha&quot;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin: 0in 0in 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp; objSampleClass.setStrUsername(&lt;/span&gt;&lt;span style=&quot;color: #073763; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&quot;Chakravartin&quot;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin: 0in 0in 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;
objSampleClass.setStrPassword(&lt;/span&gt;&lt;span style=&quot;color: #073763; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&quot;Ashokavadana&quot;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, we execute the &lt;b&gt;DeserializeFileToObject&lt;/b&gt; class, to &lt;b&gt;deserialize &lt;/b&gt;the &lt;b&gt;object &lt;/b&gt;of &lt;b&gt;SampleClass&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Class&amp;nbsp;DeserializeFileToObject :&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div style=&quot;background: #D9D9D9; border: solid windowtext 1.0pt; mso-background-themecolor: background1; mso-background-themeshade: 217; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div; padding: 1.0pt 4.0pt 1.0pt 4.0pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;package&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;
com.interview.question.java;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;import&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;
java.io.FileInputStream;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;import&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;
java.io.ObjectInputStream;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;class&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; &lt;span style=&quot;background: silver; mso-highlight: silver;&quot;&gt;DeserializeFileToObject&lt;/span&gt; {&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;/**&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * This class &lt;u&gt;deserializes&lt;/u&gt; data from
a file &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * sampleClass.ser to an Object of
SampleClass&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f9fbf; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;@author&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;
http://interviewquestionjava.blogspot.com&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; **/&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;static&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;void&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; main(String[]
args) {&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SampleClass objSampleClass = &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;null&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;try&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FileInputStream objFileInputStream =
&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;new&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;
FileInputStream(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&quot;src/com/interview/question/java/sampleClass.ser&quot;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ObjectInputStream objInputStream = &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;new&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;
ObjectInputStream(objFileInputStream);&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objSampleClass =
(SampleClass)objInputStream.readObject();&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objInputStream.close();&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objFileInputStream.close();&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&quot;=======================
Deserialized Data =======================&quot;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&quot;strName
: &quot;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;+objSampleClass.getStrName());&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&quot;strAddress
: &quot;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;+objSampleClass.getStrAddress());&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&quot;strUsername
: &quot;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;+objSampleClass.getStrUsername());&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&quot;strPassword
: &quot;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;+objSampleClass.getStrPassword());&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&quot;=================================================================&quot;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;catch&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; (Exception e) &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.printStackTrace();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;br /&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;b&gt;Output :&lt;/b&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;br /&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div style=&quot;background: #CCC0D9; border: solid windowtext 1.0pt; mso-background-themecolor: accent4; mso-background-themetint: 102; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div; padding: 1.0pt 4.0pt 1.0pt 4.0pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
======================= Deserialized Data =======================&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
strName : Ashoka Maurya&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
strAddress : Magadha&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
strUsername : Chakravartin&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
strPassword : null&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.0001pt; padding: 0in;&quot;&gt;
=================================================================&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, we can see, we get all the data from the &lt;b&gt;deserialized &lt;/b&gt;object except &lt;b&gt;strPassword&lt;/b&gt;, as it is decleared as &lt;b&gt;transient&lt;/b&gt;.&lt;/div&gt;
</description><link>http://interviewquestionjava.blogspot.com/2013/08/java-deserializing-object-from-file.html</link><author>noreply@blogger.com (Anijit Sarkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUxDPbOlDsk8KlydHPv5SnJPzF-pvJKOL1bV5wSgAnVi_rHyeWcDEiJPeb0AzDs-qcqpeh36XHLXfwREJCXAe16L1Brml1ef_2z3TembQakuwEHgkiN94QGpr24Ca5yrCbLXYfBSDXOT8/s72-c/java.png" height="72" width="72"/><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3166332459178575831.post-3631935251578910489</guid><pubDate>Sun, 11 Aug 2013 11:01:00 +0000</pubDate><atom:updated>2014-02-10T17:51:01.162+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">JAVA</category><category domain="http://www.blogger.com/atom/ns#">JAVA INTERVIEW QUESTIONS</category><title>JAVA: Keyword: abstract</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;border-collapse: collapse; width: 64px;&quot;&gt;&lt;tbody&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15pt;&quot;&gt;&lt;td height=&quot;20&quot; style=&quot;height: 15pt; width: 48pt;&quot; width=&quot;64&quot;&gt;&lt;h3&gt;
&lt;b&gt;abstract:&lt;/b&gt;&lt;/h3&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKw-2aykn8esX3B_PrStEHqzCOzhztDyiM6Jr5WWUaUXHKSt-JUT3l9qrYsUWgqgTdTZI7KBYkfQc5Fizn5BXto_vsqE0k3L6iNyOBx2jomBbXI5Ik50fKnAsTWz24L5mWCSWxvqBTeaQ/s1600/Java4.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKw-2aykn8esX3B_PrStEHqzCOzhztDyiM6Jr5WWUaUXHKSt-JUT3l9qrYsUWgqgTdTZI7KBYkfQc5Fizn5BXto_vsqE0k3L6iNyOBx2jomBbXI5Ik50fKnAsTWz24L5mWCSWxvqBTeaQ/s200/Java4.png&quot; height=&quot;200&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;This is used to define a class or a method as an &lt;b&gt;abstract&lt;/b&gt; operation. When a method is declared as abstract, that means, the method where it is declared (within the class) have no body of the method rather the method can be overridden, through inheritance and define it&#39;s body.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;When a class &amp;nbsp;contains any abstract method, it must be declared as abstract.&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: sans-serif; font-size: 13px; line-height: 19.1875px;&quot;&gt;An abstract class cannot be&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;background-color: #f9f9f9; font-family: monospace, Courier; font-size: 13px; line-height: 19.1875px;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2012/01/what-is-final.html&quot; target=&quot;_blank&quot;&gt;final&lt;/a&gt;&lt;/span&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; font-family: sans-serif; font-size: 13px; line-height: 19.1875px;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: sans-serif; font-size: 13px; line-height: 19.1875px;&quot;&gt;An abstract method cannot be&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;background-color: #f9f9f9; font-family: monospace, Courier; font-size: 13px; line-height: 19.1875px;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2012/01/what-is-final.html&quot; target=&quot;_blank&quot;&gt;final&lt;/a&gt;&lt;/span&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; font-family: sans-serif; font-size: 13px; line-height: 19.1875px;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;background-color: #f9f9f9; font-family: monospace, Courier; font-size: 13px; line-height: 19.1875px;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2012/01/what-is-static-in-java.html&quot; target=&quot;_blank&quot;&gt;static&lt;/a&gt;&lt;/span&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; font-family: sans-serif; font-size: 13px; line-height: 19.1875px;&quot;&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2012/01/what-is-static-in-java.html&quot; target=&quot;_blank&quot;&gt;&amp;nbsp;&lt;/a&gt;nor&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;background-color: #f9f9f9; font-family: monospace, Courier; font-size: 13px; line-height: 19.1875px;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;native&lt;/span&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; font-family: sans-serif; font-size: 13px; line-height: 19.1875px;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;background-color: white; border: 0px; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;
&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;
&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;
&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;
&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;Code:&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #d9d9d9; background-position: initial initial; background-repeat: initial initial; border: 1pt solid windowtext; margin: 0px; padding: 1pt 4pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #7f0055; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;span class=&quot;IL_AD&quot; id=&quot;IL_AD5&quot; style=&quot;background-attachment: scroll !important; background-color: transparent !important; background-image: none !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(27, 142, 222) !important; border-bottom-style: dotted !important; border-bottom-width: 1px !important; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; color: rgb(27, 142, 222) !important; cursor: pointer !important; display: inline !important; float: none !important; margin: 0px; padding: 0px 0px 1px !important; position: static;&quot;&gt;package&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;com.&lt;span class=&quot;IL_AD&quot; id=&quot;IL_AD6&quot; style=&quot;background-attachment: scroll !important; background-color: transparent !important; background-image: none !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(27, 142, 222) !important; border-bottom-style: dotted !important; border-bottom-width: 1px !important; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; color: rgb(27, 142, 222) !important; cursor: pointer !important; display: inline !important; float: none !important; margin: 0px; padding: 0px 0px 1px !important; position: static;&quot;&gt;interview&lt;/span&gt;.question.java;&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;br style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #7f0055; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;abstract&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #7f0055; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;class&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;SampleAbstractClass {&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #3f5fbf; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;/**&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #3f5fbf; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #3f5fbf; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Sample&amp;nbsp;abstract&amp;nbsp;class.&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #3f5fbf; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #3f5fbf; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #7f9fbf; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;@author&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;border: 0px; color: #3f5fbf; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;http://interviewquestionjava.blogspot.com&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #3f5fbf; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #3f5fbf; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #3f7f5f; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;// Sample&amp;nbsp;abstract&amp;nbsp;method.&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #7f0055; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #7f0055; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;abstract&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #7f0055; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;void&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;sampleabstractmethod() ;&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #7f0055; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #7f0055; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;void&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;sampleNormalMethod(){&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #0000c0; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #2a00ff; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&quot;SampleAbstractClass.sampleNormalMethod()&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;br style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;br style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;br style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #7f0055; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #7f0055; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;class&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;TestAbstractClass{&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #3f5fbf; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;/**&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #3f5fbf; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #3f5fbf; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Sample class to call SampleAbstractClass.&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #3f5fbf; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #3f5fbf; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #7f9fbf; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;@author&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;border: 0px; color: #3f5fbf; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;http://interviewquestionjava.blogspot.com&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #3f5fbf; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #3f5fbf; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #7f0055; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #7f0055; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;static&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #7f0055; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;void&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;main(String[] args) {&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SampleAbstractClass objSampleAbstractClass =&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #7f0055; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;new&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;SampleAbstractClass() {&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #646464; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;@Override&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #7f0055; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #7f0055; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;void&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;sampleabstractmethod() {&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.&lt;/span&gt;&lt;i style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #0000c0; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .println(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #2a00ff; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&quot;TestAbstractClass.main(...).new SampleAbstractClass() {...}.sampleabstractmethod()&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objSampleAbstractClass.sampleabstractmethod();&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px 0px 0.0001pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; margin: 0px; padding: 0px;&quot;&gt;&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px; padding: 0in;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: &#39;Courier New&#39;; font-size: 10pt; line-height: 14px; margin: 0px; padding: 0px;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;
&lt;br style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;
&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;Output:&lt;o:p style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;br style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; /&gt;
&lt;div style=&quot;background-color: #ccc0d9; background-position: initial initial; background-repeat: initial initial; border: 1pt solid windowtext; margin: 0px; padding: 1pt 4pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border: none; margin: 0px; padding: 0in;&quot;&gt;
TestAbstractClass.main(...).new SampleAbstractClass() {...}.sampleabstractmethod()&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: #d9d9d9; background-position: initial initial; background-repeat: initial initial; border: 1pt solid windowtext; margin: 0px; padding: 1pt 4pt;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;background: #D9D9D9; border: solid windowtext 1.0pt; mso-background-themecolor: background1; mso-background-themeshade: 217; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div; padding: 1.0pt 4.0pt 1.0pt 4.0pt;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://interviewquestionjava.blogspot.com/2013/08/java-keyword-abstract.html</link><author>noreply@blogger.com (Anijit Sarkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKw-2aykn8esX3B_PrStEHqzCOzhztDyiM6Jr5WWUaUXHKSt-JUT3l9qrYsUWgqgTdTZI7KBYkfQc5Fizn5BXto_vsqE0k3L6iNyOBx2jomBbXI5Ik50fKnAsTWz24L5mWCSWxvqBTeaQ/s72-c/Java4.png" height="72" width="72"/><thr:total>6</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3166332459178575831.post-7864310255842183480</guid><pubDate>Sun, 17 Mar 2013 16:58:00 +0000</pubDate><atom:updated>2013-03-18T23:00:58.824+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">SQL INTERVIEW QUESTIONS</category><category domain="http://www.blogger.com/atom/ns#">SQL TUTORIAL</category><title>SQL: OR Command</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQbnGtg-Xddji923zBBEej9V8XFZxfLd3T_odqX7vgU5UhL6-KOuh1ZXH25vIV1qIhNwA_3NKhwsyYtbbWqkdenQz2kv1Ygvdv2j6roNizqOid1vyHcRruHEuqMixAgcEikxWSFEmmsQc/s1600/database.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQbnGtg-Xddji923zBBEej9V8XFZxfLd3T_odqX7vgU5UhL6-KOuh1ZXH25vIV1qIhNwA_3NKhwsyYtbbWqkdenQz2kv1Ygvdv2j6roNizqOid1vyHcRruHEuqMixAgcEikxWSFEmmsQc/s200/database.png&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
In &lt;a href=&quot;http://interviewquestionjava.blogspot.com/2013/02/sql-what-is-sql.html&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;SQL&lt;/b&gt;&lt;/a&gt;, we have seen the use of &lt;a href=&quot;http://interviewquestionjava.blogspot.com/2013/02/sql-and-command.html&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;AND &lt;/b&gt;&lt;/a&gt;command, to set multiple condition when performing a &lt;b&gt;database transaction&lt;/b&gt;. But when we use &lt;a href=&quot;http://interviewquestionjava.blogspot.com/2013/02/sql-and-command.html&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;AND&lt;/b&gt;&lt;/a&gt;, that means it&#39;s a mandatory condition. The transaction will provide output, only when all the conditions will be satisfied. But, what about an optional condition? Do &lt;a href=&quot;http://interviewquestionjava.blogspot.com/2013/02/sql-what-is-sql.html&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;SQL &lt;/b&gt;&lt;/a&gt;have any provision for that? The Answer is &lt;b&gt;yes&lt;/b&gt;. &lt;a href=&quot;http://interviewquestionjava.blogspot.com/2013/02/sql-what-is-sql.html&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;SQL &lt;/b&gt;&lt;/a&gt;Do have command named &lt;b&gt;OR &lt;/b&gt;to set optional condition.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax&lt;/b&gt;: &lt;b&gt;&lt;span style=&quot;color: #741b47;&quot;&gt;SELECT [column_name] FROM [table_name] WHERE [condition_1] OR [condition_2];&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #741b47;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Here, output will come if &lt;/span&gt;&lt;/span&gt;&lt;b&gt;[condition_1] OR &lt;/b&gt;&lt;b&gt;[condition_2] OR both &lt;/b&gt;satisfied. That means, it is &lt;b&gt;SELECT [column_name] &lt;span style=&quot;color: #741b47;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;FROM [table_name] WHERE [condition_1] OR [condition_2] OR both &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #741b47;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;applied.&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #741b47;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #741b47;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;b&gt;Example:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white; border: 0px; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;Again, we will use the same table, to see the usage of&amp;nbsp; &lt;b&gt;OR &lt;/b&gt;command.&lt;br style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; /&gt;&lt;b&gt;Table Name:&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; border: 0px; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;Employee Details (&amp;nbsp;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;employee_details&lt;/b&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; border: 0px; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;b&gt;Column Names: &lt;/b&gt;&lt;br style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; /&gt;Employee ID (&amp;nbsp;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;emp_id&lt;/b&gt;),&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; border: 0px; color: #674ea7; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;Employee Name (&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;emp_name&lt;/b&gt;),&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; border: 0px; color: #674ea7; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;Employee Address (&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;emp_address&lt;/b&gt;) and&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; border: 0px; color: #674ea7; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;Employee Role:&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; border: 0px; color: #674ea7; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style=&quot;background-color: white; border: 0px; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;e&lt;/b&gt;&lt;b style=&quot;background-color: white; border: 0px; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;mp_role&lt;/b&gt;&lt;span style=&quot;background-color: white; border: 0px; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;)&lt;/span&gt;&lt;b style=&quot;background-color: white; border: 0px; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;.&lt;/b&gt;&lt;br /&gt;
&lt;br style=&quot;background-color: white; border: 0px; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot; /&gt;
&lt;span style=&quot;background-color: white; border: 0px; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;Table:&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;i style=&quot;background-color: white; border: 0px; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;employee_details&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOkC37EykDpNa7LfNLyxmpbOKmOLJBaUwksJMx-5C1LoJYz3Tooqj7as9wzW0OqpJhxLvXFaG2wDTTmFRA_c67L-9G1VqK7lQjEuXaApmMd9Vc0hF2Sc-Px2TSAm2y0NJxmjGmpn1UH00/s1600/New+Picture+%25282%2529.bmp&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOkC37EykDpNa7LfNLyxmpbOKmOLJBaUwksJMx-5C1LoJYz3Tooqj7as9wzW0OqpJhxLvXFaG2wDTTmFRA_c67L-9G1VqK7lQjEuXaApmMd9Vc0hF2Sc-Px2TSAm2y0NJxmjGmpn1UH00/s1600/New+Picture+%25282%2529.bmp&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
Now, using &lt;b&gt;OR &lt;/b&gt;command, we will &lt;b&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2013/02/sql-select-command.html&quot; target=&quot;_blank&quot;&gt;SELECT &lt;/a&gt;&lt;/b&gt;those &lt;b&gt;tuple&lt;/b&gt;, &lt;b&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2013/02/sql-where-command.html&quot; target=&quot;_blank&quot;&gt;WHERE &lt;/a&gt;emp_role &lt;/b&gt;is &#39;Developer&#39; or &#39;Business Analyst&#39;.&lt;br /&gt;
So, the query will be :&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #741b47;&quot;&gt;SELECT * FROM employee_details WHERE emp_role = &#39;Developer&#39; OR &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: #741b47;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #741b47;&quot;&gt;emp_role = &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: #741b47;&quot;&gt;&#39;Business Analyst&#39;;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #741b47;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b style=&quot;background-color: white; border: 0px; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;Result:&lt;/b&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;background-color: white; border: 0px; clear: both; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdWNvQs4jm-W76lN0CKtThHiwyg-LVQOP6PV1KTLfjEY2hhAKR_gK6A8wJ2Xb75UAR4MK1Bb3_ktTzgjtaLRWH1mkNXlyBVPM7Okt1iRmdgaEG74oCDw6iHV3IvCcbubTtVQ1QosPe7hA/s1600/SQL+OR+Command+-+IMAGE+-+interviewquestionjava.blogspot.com.bmp&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdWNvQs4jm-W76lN0CKtThHiwyg-LVQOP6PV1KTLfjEY2hhAKR_gK6A8wJ2Xb75UAR4MK1Bb3_ktTzgjtaLRWH1mkNXlyBVPM7Okt1iRmdgaEG74oCDw6iHV3IvCcbubTtVQ1QosPe7hA/s1600/SQL+OR+Command+-+IMAGE+-+interviewquestionjava.blogspot.com.bmp&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #741b47;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
</description><link>http://interviewquestionjava.blogspot.com/2013/03/sql-or-command.html</link><author>noreply@blogger.com (Anijit Sarkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQbnGtg-Xddji923zBBEej9V8XFZxfLd3T_odqX7vgU5UhL6-KOuh1ZXH25vIV1qIhNwA_3NKhwsyYtbbWqkdenQz2kv1Ygvdv2j6roNizqOid1vyHcRruHEuqMixAgcEikxWSFEmmsQc/s72-c/database.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3166332459178575831.post-4208552512480274027</guid><pubDate>Thu, 28 Feb 2013 19:01:00 +0000</pubDate><atom:updated>2013-03-18T22:56:47.530+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">SQL INTERVIEW QUESTIONS</category><category domain="http://www.blogger.com/atom/ns#">SQL TUTORIAL</category><title>SQL: AND Command</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAQnqo5XCJk8n8v3VCV4H7w1IOzJRdPIdt9cK0tYINwwZ047-H6v76yiWBobun_gO5lN2-i9dvMWkQC7d290iKunep3h7SSXAeKfX6r3gMJhNct6-E7fW0OEGy5sduAM1-Yn1h54qa4u0/s1600/SQL-logo-300x225.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;150&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAQnqo5XCJk8n8v3VCV4H7w1IOzJRdPIdt9cK0tYINwwZ047-H6v76yiWBobun_gO5lN2-i9dvMWkQC7d290iKunep3h7SSXAeKfX6r3gMJhNct6-E7fW0OEGy5sduAM1-Yn1h54qa4u0/s200/SQL-logo-300x225.jpg&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
In &lt;b&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.in/2013/02/sql-what-is-sql.html&quot; target=&quot;_blank&quot;&gt;SQL&lt;/a&gt;&lt;/b&gt;, we have, seen that, we can add conditions by using &lt;b&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2013/02/sql-where-command.html&quot; target=&quot;_blank&quot;&gt;WHERE &lt;/a&gt;&lt;/b&gt;command, during any &lt;b&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2013/02/sql-select-command.html&quot; target=&quot;_blank&quot;&gt;SELECT&lt;/a&gt;&lt;/b&gt;, &lt;b&gt;UPDATE &lt;/b&gt;or &lt;b&gt;DELETE&amp;nbsp;&lt;/b&gt;operation. Now, what about multiple conditions? For that, &lt;b&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.in/2013/02/sql-what-is-sql.html&quot; target=&quot;_blank&quot;&gt;SQL &lt;/a&gt;&lt;/b&gt;provides to add multiple condition by using &lt;b&gt;AND &lt;/b&gt;command. it can be used as many times as you want.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax&lt;/b&gt;: &lt;b&gt;&lt;span style=&quot;color: #741b47;&quot;&gt;SELECT [column_name] FROM [table_name] WHERE [condition_1] AND [condition_2];&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;[&lt;b&gt;Note:&lt;/b&gt; &lt;b&gt;AND &lt;/b&gt;means mandatory condition, that means, the operation has to always&amp;nbsp;fulfill the criteria provied under &lt;b&gt;AND &lt;/b&gt;block.&amp;nbsp;]&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;
&lt;b&gt;Example:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white; border: 0px; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;Again, use the same table, we will see the usage of &amp;nbsp;&lt;b&gt;AND &lt;/b&gt;command.&lt;br style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; /&gt;Employee Details (&amp;nbsp;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;employee_details&lt;/b&gt;), which contains&amp;nbsp;&lt;br style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; /&gt;Employee ID (&amp;nbsp;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;emp_id&lt;/b&gt;),&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; border: 0px; color: #674ea7; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;Employee Name (&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;emp_name&lt;/b&gt;),&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; border: 0px; color: #674ea7; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;Employee Address (&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;emp_address&lt;/b&gt;) and&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; border: 0px; color: #674ea7; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;Employee Role:&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; border: 0px; color: #674ea7; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style=&quot;background-color: white; border: 0px; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;e&lt;/b&gt;&lt;b style=&quot;background-color: white; border: 0px; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;mp_role&lt;/b&gt;&lt;span style=&quot;background-color: white; border: 0px; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;)&lt;/span&gt;&lt;b style=&quot;background-color: white; border: 0px; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;.&lt;/b&gt;&lt;br /&gt;
&lt;br style=&quot;background-color: white; border: 0px; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot; /&gt;
&lt;span style=&quot;background-color: white; border: 0px; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;Table:&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;i style=&quot;background-color: white; border: 0px; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;employee_details&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOkC37EykDpNa7LfNLyxmpbOKmOLJBaUwksJMx-5C1LoJYz3Tooqj7as9wzW0OqpJhxLvXFaG2wDTTmFRA_c67L-9G1VqK7lQjEuXaApmMd9Vc0hF2Sc-Px2TSAm2y0NJxmjGmpn1UH00/s1600/New+Picture+%25282%2529.bmp&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;116&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOkC37EykDpNa7LfNLyxmpbOKmOLJBaUwksJMx-5C1LoJYz3Tooqj7as9wzW0OqpJhxLvXFaG2wDTTmFRA_c67L-9G1VqK7lQjEuXaApmMd9Vc0hF2Sc-Px2TSAm2y0NJxmjGmpn1UH00/s640/New+Picture+%25282%2529.bmp&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, using &lt;b&gt;AND&lt;/b&gt; command, we will &lt;b&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2013/02/sql-select-command.html&quot; target=&quot;_blank&quot;&gt;SELECT &lt;/a&gt;&lt;/b&gt;those &lt;b&gt;tuple&lt;/b&gt;, &lt;b&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2013/02/sql-where-command.html&quot; target=&quot;_blank&quot;&gt;WHERE &lt;/a&gt;emp_role &lt;/b&gt;is &#39;Developer&#39; and &lt;b&gt;emp_address &lt;/b&gt;is &#39;Park Street, Kolkata&#39;.&lt;br /&gt;
So, the query will be :&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #741b47;&quot;&gt;SELECT * FROM employee_details WHERE emp_role = &#39;Developer&#39; AND emp_address = &#39;Park Street, Kolkata&#39;;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #741b47;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b style=&quot;background-color: white; border: 0px; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;Result:&lt;/b&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;background-color: white; border: 0px; clear: both; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_Yzc-WDxyy-d_1xB7plx5YCgBLN3tvdQ6F5pRJ8NtxgiVsswnyd_3Xd-n768cgYP-f2soIcElL2WFJbFUz0XQfV5k34CPBF2nqoOWq1gWyfV27FLUJryUFzAFy2DafcoGvrKnswD0hEA/s1600/New+Picture.bmp&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;48&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_Yzc-WDxyy-d_1xB7plx5YCgBLN3tvdQ6F5pRJ8NtxgiVsswnyd_3Xd-n768cgYP-f2soIcElL2WFJbFUz0XQfV5k34CPBF2nqoOWq1gWyfV27FLUJryUFzAFy2DafcoGvrKnswD0hEA/s640/New+Picture.bmp&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this way, we can use multiple conditions on an &lt;b&gt;RDBMS &lt;/b&gt;operation.&lt;/div&gt;
</description><link>http://interviewquestionjava.blogspot.com/2013/02/sql-and-command.html</link><author>noreply@blogger.com (Anijit Sarkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAQnqo5XCJk8n8v3VCV4H7w1IOzJRdPIdt9cK0tYINwwZ047-H6v76yiWBobun_gO5lN2-i9dvMWkQC7d290iKunep3h7SSXAeKfX6r3gMJhNct6-E7fW0OEGy5sduAM1-Yn1h54qa4u0/s72-c/SQL-logo-300x225.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3166332459178575831.post-3372319201053561817</guid><pubDate>Fri, 22 Feb 2013 19:10:00 +0000</pubDate><atom:updated>2013-02-23T10:03:01.380+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">SQL INTERVIEW QUESTIONS</category><category domain="http://www.blogger.com/atom/ns#">SQL TUTORIAL</category><title>SQL: WHERE Command</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
In &lt;b&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.in/2013/02/sql-what-is-sql.html&quot; target=&quot;_blank&quot;&gt;SQL&lt;/a&gt;&lt;/b&gt;,when ever you want to &lt;b&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2013/02/sql-select-command.html&quot; target=&quot;_blank&quot;&gt;SELECT &lt;/a&gt;&lt;/b&gt;some data, or &lt;b&gt;UPDATE &lt;/b&gt;or &lt;b&gt;DELETE &lt;/b&gt;some information from a &lt;b&gt;Table&lt;/b&gt;, you needs to provide some condition, on basis of which operation will be performed. It&#39;s not necessary to &lt;b&gt;SELECT&lt;/b&gt;, &lt;b&gt;UPDATE &lt;/b&gt;or &lt;b&gt;DELETE &lt;/b&gt;all data from a table or view. So, condition is necessary to filter the data when performing an operation on &lt;b&gt;database&lt;/b&gt;. The basic structure of of &lt;b&gt;WHERE &lt;/b&gt;conditions is :&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&amp;nbsp; Syntax:&lt;/b&gt;&amp;nbsp;&lt;span style=&quot;color: #741b47;&quot;&gt;&lt;b&gt;SELECT [column_name] FROM [table_name] WHERE [condition]&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #741b47;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;b&gt;Example:&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;Again, we will see the same table&lt;br style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; /&gt;Employee Details (&amp;nbsp;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;employee_details&lt;/b&gt;), which contains&amp;nbsp;&lt;br style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; /&gt;Employee ID (&amp;nbsp;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;emp_id&lt;/b&gt;),&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #674ea7; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;Employee Name (&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;emp_name&lt;/b&gt;),&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #674ea7; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;Employee Address (&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;emp_address&lt;/b&gt;) and&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #674ea7; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;Employee Role:&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #674ea7; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style=&quot;border: 0px; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;e&lt;/b&gt;&lt;b style=&quot;background-color: white; border: 0px; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;mp_role&lt;/b&gt;&lt;span style=&quot;background-color: white; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px;&quot;&gt;)&lt;/span&gt;&lt;b style=&quot;background-color: white; border: 0px; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;.&lt;/b&gt;&lt;br /&gt;
&lt;br style=&quot;background-color: white; border: 0px; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot; /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;Table:&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;i style=&quot;border: 0px; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; font-size: 12px; line-height: 22px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #003001; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #674ea7; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: #351c75; margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;&lt;b style=&quot;border: 0px; margin: 0px; padding: 0px;&quot;&gt;employee_details&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOkC37EykDpNa7LfNLyxmpbOKmOLJBaUwksJMx-5C1LoJYz3Tooqj7as9wzW0OqpJhxLvXFaG2wDTTmFRA_c67L-9G1VqK7lQjEuXaApmMd9Vc0hF2Sc-Px2TSAm2y0NJxmjGmpn1UH00/s1600/New+Picture+%25282%2529.bmp&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;116&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOkC37EykDpNa7LfNLyxmpbOKmOLJBaUwksJMx-5C1LoJYz3Tooqj7as9wzW0OqpJhxLvXFaG2wDTTmFRA_c67L-9G1VqK7lQjEuXaApmMd9Vc0hF2Sc-Px2TSAm2y0NJxmjGmpn1UH00/s640/New+Picture+%25282%2529.bmp&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
Now, from this table, if a situation&amp;nbsp;ariser, where we have to just select the information of the developers, the we have to set some condition on our &lt;b&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.com/2013/02/sql-select-command.html&quot; target=&quot;_blank&quot;&gt;SELECT &lt;/a&gt;&lt;/b&gt;query, so that we can get the details of the employees with &#39;&lt;b&gt;emp_role&lt;/b&gt;&#39; &#39;&lt;b&gt;Developer&lt;/b&gt;&#39; . Then the &lt;b&gt;Query &lt;/b&gt;will be&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #741b47;&quot;&gt;SELECT * FROM employee_details WHERE emp_role = &#39;Developer&#39;;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #741b47;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;Result:&lt;/b&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjY3JZxbH8G0YpVfWUlCLMAeOdTNO12jKoHZV-IcpN_b5nDC5uEMtZEAnWvWYKH2SdfaNnHFFrkrqzZML0G1G3C478JYxQ6wRgcpR6cfaK1u3xWur63E87F0Q5gKllVzMNhHjgWTVzaeoo/s1600/New+Picture.bmp&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;71&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjY3JZxbH8G0YpVfWUlCLMAeOdTNO12jKoHZV-IcpN_b5nDC5uEMtZEAnWvWYKH2SdfaNnHFFrkrqzZML0G1G3C478JYxQ6wRgcpR6cfaK1u3xWur63E87F0Q5gKllVzMNhHjgWTVzaeoo/s400/New+Picture.bmp&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
In this way we can filter our data output.&lt;/div&gt;
</description><link>http://interviewquestionjava.blogspot.com/2013/02/sql-where-command.html</link><author>noreply@blogger.com (Anijit Sarkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOkC37EykDpNa7LfNLyxmpbOKmOLJBaUwksJMx-5C1LoJYz3Tooqj7as9wzW0OqpJhxLvXFaG2wDTTmFRA_c67L-9G1VqK7lQjEuXaApmMd9Vc0hF2Sc-Px2TSAm2y0NJxmjGmpn1UH00/s72-c/New+Picture+%25282%2529.bmp" height="72" width="72"/><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3166332459178575831.post-1426113000911397058</guid><pubDate>Sun, 17 Feb 2013 12:01:00 +0000</pubDate><atom:updated>2013-03-18T22:59:20.179+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">SQL INTERVIEW QUESTIONS</category><category domain="http://www.blogger.com/atom/ns#">SQL TUTORIAL</category><title>SQL: SELECT Command</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9dY_SD2K52GNCQ0cptAjujI8xmA3QXD-D874V9axq5r15dNHJIC5KzNDazKbT5Zo_-gg8NvHSUHfYsJ0LYIiB_bpKzn4GJDLiQdxxA5i0oQjVVYZtZB3HGKCKLk81pttV-83GLc-tBTA/s1600/Database_1.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9dY_SD2K52GNCQ0cptAjujI8xmA3QXD-D874V9axq5r15dNHJIC5KzNDazKbT5Zo_-gg8NvHSUHfYsJ0LYIiB_bpKzn4GJDLiQdxxA5i0oQjVVYZtZB3HGKCKLk81pttV-83GLc-tBTA/s200/Database_1.png&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b&gt;SELECT &lt;/b&gt;command is use in &lt;a href=&quot;http://interviewquestionjava.blogspot.com/2013/02/sql-what-is-sql.html&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;SQL &lt;/b&gt;&lt;/a&gt;to &lt;span style=&quot;color: #351c75;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&quot;SELECT [some info] FROM [a location]&quot;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;.&lt;b&gt;&amp;nbsp;&lt;/b&gt; Now, this is the basic structure of the &lt;b&gt;SELECT &lt;/b&gt;query, where &lt;b&gt;SELECT &lt;/b&gt;and &lt;b&gt;FROM &lt;/b&gt;are 2 commands of &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2013/02/sql-what-is-sql.html&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;SQL&lt;/b&gt;&lt;/a&gt;. Here, &lt;b&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;[some info]&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;part will be the column names separated by &lt;b&gt;comma (,)&lt;/b&gt; sign and &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;[a location&lt;span style=&quot;color: #674ea7;&quot;&gt;]&lt;/span&gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;part will be the name of the &lt;b&gt;Table &lt;/b&gt;or &lt;b&gt;View&lt;/b&gt;. So, the syntax will be :&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;b&gt;For Single Column :&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;b&gt;Syntax : &lt;span style=&quot;color: #351c75;&quot;&gt;SELECT [Column_name] FROM [Table_Name];&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;b&gt;For Multiple Columns :&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;b&gt;Syntax : &lt;span style=&quot;color: #351c75;&quot;&gt;SELECT [Column1_name, &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;Column&lt;span style=&quot;color: black;&quot;&gt;2&lt;/span&gt;_name, &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;Column&lt;span style=&quot;color: black;&quot;&gt;3&lt;/span&gt;_name&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;] FROM [Table_Name];&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Now, what if you want to select all the columns of a table or a view.&lt;span style=&quot;color: #003001;&quot;&gt; &lt;span style=&quot;color: black;&quot;&gt;Do you have to write all the column name for that. No necessarily, you can user the &lt;b&gt;star (*) &lt;/b&gt;sign in &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #003001;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;[Column_name] &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;area. Then the &lt;b&gt;syntax &lt;/b&gt;will be:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;b&gt;For All Columns :&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #003001;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;b&gt;Syntax : &lt;span style=&quot;color: #351c75;&quot;&gt;SELECT * FROM [Table_Name];&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;/a&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #003001;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Example:&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #003001;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Suppose there is a table to keep &lt;br /&gt;Employee Details (Table Name: &lt;b&gt;employee_details&lt;/b&gt;), which contains &lt;br /&gt;Employee ID(Column Name: &lt;b&gt;emp_id&lt;/b&gt;),&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;!--
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
--&gt;
&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #003001;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Employee Name(Column Name: &lt;b&gt;emp_name&lt;/b&gt;),&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;!--
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
--&gt;
&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #003001;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Employee Address:(Column Name: &lt;b&gt;emp_address&lt;/b&gt;) and&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #003001;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Employee Role: &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #003001;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #003001;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;(Column Name: &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b&gt;emp_role&lt;/b&gt;)&lt;b&gt;.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;!--
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
--&gt;
&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #003001;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;b&gt;Table:&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #003001;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;b&gt;&amp;nbsp; &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #003001;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;b&gt;employee_details&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOkC37EykDpNa7LfNLyxmpbOKmOLJBaUwksJMx-5C1LoJYz3Tooqj7as9wzW0OqpJhxLvXFaG2wDTTmFRA_c67L-9G1VqK7lQjEuXaApmMd9Vc0hF2Sc-Px2TSAm2y0NJxmjGmpn1UH00/s1600/New+Picture+(2).bmp&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;73&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOkC37EykDpNa7LfNLyxmpbOKmOLJBaUwksJMx-5C1LoJYz3Tooqj7as9wzW0OqpJhxLvXFaG2wDTTmFRA_c67L-9G1VqK7lQjEuXaApmMd9Vc0hF2Sc-Px2TSAm2y0NJxmjGmpn1UH00/s400/New+Picture+(2).bmp&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #003001;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;Now,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; to select &lt;b&gt;emp_id&lt;/b&gt; and &lt;b&gt;emp_name &lt;/b&gt;from the table, the query will be,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #003001;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #003001;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;b&gt;SELECT emp_id&lt;span style=&quot;color: black;&quot;&gt;,&lt;/span&gt; emp_name FROM employee_details;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #003001;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: black;&quot;&gt;Result&lt;span style=&quot;color: #b00000;&quot;&gt;: &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgW_MRGBqxDZ_3HZH-pyMkdGslkBIV_2cwTF18iPuXZa-TBdifzbfQjceMo3SgbLchjrPvCT-7dnYNHrfZ3CKA8DPgnCVIgdnCDgHC5OEdrIP-b2ebgNwQiPYR7j4ShUypL14gGkFpI4tk/s1600/New+Picture+(3).bmp&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;86&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgW_MRGBqxDZ_3HZH-pyMkdGslkBIV_2cwTF18iPuXZa-TBdifzbfQjceMo3SgbLchjrPvCT-7dnYNHrfZ3CKA8DPgnCVIgdnCDgHC5OEdrIP-b2ebgNwQiPYR7j4ShUypL14gGkFpI4tk/s200/New+Picture+(3).bmp&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #003001;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;Again, if you wants to select all the colunms&#39; record, then the query will be,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #003001;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #003001;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #003001;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;b&gt;SELECT * FROM employee_details;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #003001;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #003001;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: black;&quot;&gt;Result:&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #003001;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #003001;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;b&gt; &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyKA0dMaLIVmMVsIaZvVeRyVLfLogsJehtDDqkRHGnPBNhuCGAj-ZD-kFWxf3QdDXvM3xLFYzgKZV-4rxeAxUjO1nBMFUYbxaQnsYYOuROITaz1p3d9Eu6vthN9r9jCW-wsyYSvPgyzZs/s1600/New+Picture+(5).bmp&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;77&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyKA0dMaLIVmMVsIaZvVeRyVLfLogsJehtDDqkRHGnPBNhuCGAj-ZD-kFWxf3QdDXvM3xLFYzgKZV-4rxeAxUjO1nBMFUYbxaQnsYYOuROITaz1p3d9Eu6vthN9r9jCW-wsyYSvPgyzZs/s400/New+Picture+(5).bmp&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #003001;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #351c75;&quot;&gt; &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
</description><link>http://interviewquestionjava.blogspot.com/2013/02/sql-select-command.html</link><author>noreply@blogger.com (Anijit Sarkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9dY_SD2K52GNCQ0cptAjujI8xmA3QXD-D874V9axq5r15dNHJIC5KzNDazKbT5Zo_-gg8NvHSUHfYsJ0LYIiB_bpKzn4GJDLiQdxxA5i0oQjVVYZtZB3HGKCKLk81pttV-83GLc-tBTA/s72-c/Database_1.png" height="72" width="72"/><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3166332459178575831.post-4088650292618193497</guid><pubDate>Thu, 14 Feb 2013 20:59:00 +0000</pubDate><atom:updated>2013-03-18T23:02:06.070+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">JAVA</category><category domain="http://www.blogger.com/atom/ns#">JAVA INTERVIEW QUESTIONS</category><title>JAVA: Parse String to Double</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;Paser String to Double:&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;You can parse a double value in string format to double in 4 ways.&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKa5RmFrzAH_l0AyP3h2-kTYwAMDYYyaPll7_WmZF5Gr5D_UjhITnBxn8wwpt7M7cRvNwYmQwXvSj_q6kyoRQQo3S2wEOmNVbUGxb3ff1aK6hLGwSltIF3et0hhKAFoXfjEa_OTE0_T_Y/s1600/Java1.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKa5RmFrzAH_l0AyP3h2-kTYwAMDYYyaPll7_WmZF5Gr5D_UjhITnBxn8wwpt7M7cRvNwYmQwXvSj_q6kyoRQQo3S2wEOmNVbUGxb3ff1aK6hLGwSltIF3et0hhKAFoXfjEa_OTE0_T_Y/s200/Java1.png&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;
&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;Double.valueof(String s) :&amp;nbsp; &lt;/b&gt;This method returns a double object containing the value invoked in it in string format.&lt;/span&gt;&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;It can trim white-space in start or end of the string argument, by using &lt;b&gt;String.trim()&lt;/b&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;It &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/01/java-difference-between-throw-throws.html&quot; target=&quot;_blank&quot;&gt;throws &lt;/a&gt;&lt;b&gt;NumberFormatException &lt;/b&gt;if the string argument is not in proper form. &lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;
&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&lt;b&gt;Double.parseDouble(String s) : &lt;/b&gt;This method also returns a double instance containing the invoked string value. &lt;/span&gt;&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;It can also trim white space in start and end of the input value, using &lt;b&gt;String.trim()&lt;/b&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;It also throws &lt;b&gt;NumberFormatException &lt;/b&gt;if the string argument is not in proper form. &lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;
&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;new Double(String paramString)&lt;/b&gt; : You a also parse a string argument containing float value by invoking it on the constructor of the Class Double. its internally using the &lt;b&gt;valueof(String s) &lt;/b&gt;method and returns a new Double instance containing the parsed double value.&lt;b&gt; &lt;/b&gt;So it is also using &lt;br /&gt;&lt;b&gt;String.trim() &lt;/b&gt;and&lt;b&gt; &lt;/b&gt;throws &lt;b&gt;NumberFormatException&lt;/b&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;
&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Fourth one, the last one is the very important one, actually its been used by all the above 3 APIs. &lt;b&gt;sun.misc.FloatingDecimal.readJavaFormatString(String paramString). &lt;/b&gt;Its the original method used to parse a String value to decimal value. This is the actual methods, which is trimming the white space of the string, using &lt;b&gt;String.trim()&lt;/b&gt;. It returns value in &lt;b&gt;FloatingDecimal &lt;/b&gt;instance&lt;b&gt;, &lt;/b&gt;so you need to cast it to double by using &lt;b&gt;doubleValue()&lt;/b&gt;, which is another method of Class &lt;b&gt;FloatingDecimal&lt;/b&gt;.&lt;/span&gt;&lt;br /&gt; &lt;/li&gt;
&lt;/ol&gt;
&lt;b&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Below is an example which explains the above discussion:&lt;br /&gt;&lt;br /&gt;Code:&lt;/span&gt;&lt;/b&gt; &lt;br /&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:TrackMoves/&gt;
  &lt;w:TrackFormatting/&gt;
  &lt;w:PunctuationKerning/&gt;
  &lt;w:ValidateAgainstSchemas/&gt;
  &lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
  &lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
  &lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
  &lt;w:DoNotPromoteQF/&gt;
  &lt;w:LidThemeOther&gt;EN-US&lt;/w:LidThemeOther&gt;
  &lt;w:LidThemeAsian&gt;X-NONE&lt;/w:LidThemeAsian&gt;
  &lt;w:LidThemeComplexScript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;
  &lt;w:Compatibility&gt;
   &lt;w:BreakWrappedTables/&gt;
   &lt;w:SnapToGridInCell/&gt;
   &lt;w:WrapTextWithPunct/&gt;
   &lt;w:UseAsianBreakRules/&gt;
   &lt;w:DontGrowAutofit/&gt;
   &lt;w:SplitPgBreakAndParaMark/&gt;
   &lt;w:DontVertAlignCellWithSp/&gt;
   &lt;w:DontBreakConstrainedForcedTables/&gt;
   &lt;w:DontVertAlignInTxbx/&gt;
   &lt;w:Word11KerningPairs/&gt;
   &lt;w:CachedColBalance/&gt;
  &lt;/w:Compatibility&gt;
  &lt;w:BrowserLevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;
  &lt;m:mathPr&gt;
   &lt;m:mathFont m:val=&quot;Cambria Math&quot;/&gt;
   &lt;m:brkBin m:val=&quot;before&quot;/&gt;
   &lt;m:brkBinSub m:val=&quot;--&quot;/&gt;
   &lt;m:smallFrac m:val=&quot;off&quot;/&gt;
   &lt;m:dispDef/&gt;
   &lt;m:lMargin m:val=&quot;0&quot;/&gt;
   &lt;m:rMargin m:val=&quot;0&quot;/&gt;
   &lt;m:defJc m:val=&quot;centerGroup&quot;/&gt;
   &lt;m:wrapIndent m:val=&quot;1440&quot;/&gt;
   &lt;m:intLim m:val=&quot;subSup&quot;/&gt;
   &lt;m:naryLim m:val=&quot;undOvr&quot;/&gt;
  &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;

&lt;br /&gt;
&lt;div style=&quot;background: #BFBFBF; border: solid windowtext 1.0pt; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div; padding: 1.0pt 4.0pt 1.0pt 4.0pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;package&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;
com.interview.question.java;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;class&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;
PaserStringToDouble {&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;/**&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;* &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;*
Sample class that shows how to parse a String to double.&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;* &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;* &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f9fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;@author&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;
http://interviewquestionjava.blogspot.com&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;* &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: #3f5fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;*/&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;static&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;void&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt; main(String[]
args) {&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;// &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f9fbf; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;TODO&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #3f7f5f; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;
Auto-generated method stub&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;// set a decimal value in a string
with &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;// white space on both end.&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;String strValue = &lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&quot; 12.329
&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;// parse the string to double using&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Double.valueof(String s)&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;double&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt; dblValue =
Double.&lt;i&gt;valueOf&lt;/i&gt;(strValue);&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;// parse the string to double using&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;// Double.parseDouble(String s)&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;double&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt; &lt;u&gt;dblValue2&lt;/u&gt;
= Double.&lt;i&gt;parseDouble&lt;/i&gt;(strValue);&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;// parse the string to double using &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none; text-indent: .5in;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Double(String
paramString)&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Double dblValue3 = &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;new&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;
Double(strValue);&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;// parse the string to double using
new&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;//
FloatingDecimal.readJavaFormatString&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: #3f7f5f; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//(String paramString)&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Double dblValue4 = &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;new&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;
Double(sun.misc.FloatingDecimal&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 4;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.&lt;i&gt;readJavaFormatString&lt;/i&gt;(strValue).doubleValue());&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;// printing the outputs&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;System.&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #0000c0; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;out&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&quot;dblValue:
&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt; + dblValue +&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&quot;\ndblValue2:
&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt; + dblValue&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;+ &lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&quot;\ndblValue3: &quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt; + &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;dblValue3 + &lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&quot;\ndblValue4: &quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt; + dblValue4);&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #BFBFBF; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: background1; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:TrackMoves/&gt;
  &lt;w:TrackFormatting/&gt;
  &lt;w:PunctuationKerning/&gt;
  &lt;w:ValidateAgainstSchemas/&gt;
  &lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
  &lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
  &lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
  &lt;w:DoNotPromoteQF/&gt;
  &lt;w:LidThemeOther&gt;EN-US&lt;/w:LidThemeOther&gt;
  &lt;w:LidThemeAsian&gt;X-NONE&lt;/w:LidThemeAsian&gt;
  &lt;w:LidThemeComplexScript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;
  &lt;w:Compatibility&gt;
   &lt;w:BreakWrappedTables/&gt;
   &lt;w:SnapToGridInCell/&gt;
   &lt;w:WrapTextWithPunct/&gt;
   &lt;w:UseAsianBreakRules/&gt;
   &lt;w:DontGrowAutofit/&gt;
   &lt;w:SplitPgBreakAndParaMark/&gt;
   &lt;w:DontVertAlignCellWithSp/&gt;
   &lt;w:DontBreakConstrainedForcedTables/&gt;
   &lt;w:DontVertAlignInTxbx/&gt;
   &lt;w:Word11KerningPairs/&gt;
   &lt;w:CachedColBalance/&gt;
  &lt;/w:Compatibility&gt;
  &lt;w:BrowserLevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;
  &lt;m:mathPr&gt;
   &lt;m:mathFont m:val=&quot;Cambria Math&quot;/&gt;
   &lt;m:brkBin m:val=&quot;before&quot;/&gt;
   &lt;m:brkBinSub m:val=&quot;--&quot;/&gt;
   &lt;m:smallFrac m:val=&quot;off&quot;/&gt;
   &lt;m:dispDef/&gt;
   &lt;m:lMargin m:val=&quot;0&quot;/&gt;
   &lt;m:rMargin m:val=&quot;0&quot;/&gt;
   &lt;m:defJc m:val=&quot;centerGroup&quot;/&gt;
   &lt;m:wrapIndent m:val=&quot;1440&quot;/&gt;
   &lt;m:intLim m:val=&quot;subSup&quot;/&gt;
   &lt;m:naryLim m:val=&quot;undOvr&quot;/&gt;
  &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:LatentStyles DefLockedState=&quot;false&quot; DefUnhideWhenUsed=&quot;true&quot;
  DefSemiHidden=&quot;true&quot; DefQFormat=&quot;false&quot; DefPriority=&quot;99&quot;
  LatentStyleCount=&quot;267&quot;&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;0&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Normal&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;heading 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 7&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 8&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 9&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 7&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 8&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 9&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;35&quot; QFormat=&quot;true&quot; Name=&quot;caption&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;10&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Title&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;1&quot; Name=&quot;Default Paragraph Font&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;11&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Subtitle&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;22&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Strong&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;20&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Emphasis&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;59&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Table Grid&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; UnhideWhenUsed=&quot;false&quot; Name=&quot;Placeholder Text&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;1&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;No Spacing&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; UnhideWhenUsed=&quot;false&quot; Name=&quot;Revision&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;34&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;List Paragraph&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;29&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Quote&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;30&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Intense Quote&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;19&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Subtle Emphasis&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;21&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Intense Emphasis&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;31&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Subtle Reference&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;32&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Intense Reference&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;33&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Book Title&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;37&quot; Name=&quot;Bibliography&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; QFormat=&quot;true&quot; Name=&quot;TOC Heading&quot;/&gt;
 &lt;/w:LatentStyles&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 10]&gt;
&lt;style&gt;
 /* Style Definitions */
 table.MsoNormalTable
 {mso-style-name:&quot;Table Normal&quot;;
 mso-tstyle-rowband-size:0;
 mso-tstyle-colband-size:0;
 mso-style-noshow:yes;
 mso-style-priority:99;
 mso-style-qformat:yes;
 mso-style-parent:&quot;&quot;;
 mso-padding-alt:0in 5.4pt 0in 5.4pt;
 mso-para-margin-top:0in;
 mso-para-margin-right:0in;
 mso-para-margin-bottom:10.0pt;
 mso-para-margin-left:0in;
 line-height:115%;
 mso-pagination:widow-orphan;
 font-size:11.0pt;
 font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
 mso-ascii-font-family:Calibri;
 mso-ascii-theme-font:minor-latin;
 mso-fareast-font-family:&quot;Times New Roman&quot;;
 mso-fareast-theme-font:minor-fareast;
 mso-hansi-font-family:Calibri;
 mso-hansi-theme-font:minor-latin;}
&lt;/style&gt;
&lt;![endif]--&gt;

&lt;/div&gt;
&lt;div style=&quot;background: #B2A1C7; border: solid windowtext 1.0pt; mso-background-themecolor: accent4; mso-background-themetint: 153; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div; padding: 1.0pt 4.0pt 1.0pt 4.0pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #B2A1C7; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: accent4; mso-background-themetint: 153; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;dblValue: 12.329&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #B2A1C7; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: accent4; mso-background-themetint: 153; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;dblValue2:
12.329&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #B2A1C7; border: none; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-background-themecolor: accent4; mso-background-themetint: 153; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;dblValue3:
12.329&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #B2A1C7; border: none; mso-background-themecolor: accent4; mso-background-themetint: 153; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt; padding: 0in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;dblValue4:
12.329&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://interviewquestionjava.blogspot.com/2013/02/java-parse-string-to-double.html</link><author>noreply@blogger.com (Anijit Sarkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKa5RmFrzAH_l0AyP3h2-kTYwAMDYYyaPll7_WmZF5Gr5D_UjhITnBxn8wwpt7M7cRvNwYmQwXvSj_q6kyoRQQo3S2wEOmNVbUGxb3ff1aK6hLGwSltIF3et0hhKAFoXfjEa_OTE0_T_Y/s72-c/Java1.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3166332459178575831.post-149245077567124246</guid><pubDate>Wed, 13 Feb 2013 19:41:00 +0000</pubDate><atom:updated>2013-03-18T23:02:57.448+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">SQL INTERVIEW QUESTIONS</category><category domain="http://www.blogger.com/atom/ns#">SQL TUTORIAL</category><title>SQL: What is SQL</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjWFa-ASZ0m9-JbnO_s6ZxptpMOBe1oxVN9-fofDzWVf7FUQtD_U9hiOUeIs9XbWpE5nBXPB3OmF-6_3U7IchiTh-WI0c3LvMi3ASL46onCeoUCywON7WhqSJoIq30zjgSGrhCa4f2SAI/s1600/SQL-logo-300x225-2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;150&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjWFa-ASZ0m9-JbnO_s6ZxptpMOBe1oxVN9-fofDzWVf7FUQtD_U9hiOUeIs9XbWpE5nBXPB3OmF-6_3U7IchiTh-WI0c3LvMi3ASL46onCeoUCywON7WhqSJoIq30zjgSGrhCa4f2SAI/s200/SQL-logo-300x225-2.jpg&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp; &lt;b&gt;SQL (Structured Query Language) &lt;/b&gt;is a type of &lt;b&gt;programming language&lt;/b&gt;, which uses to &lt;b&gt;communicate with database&lt;/b&gt;. It’s also known as “&lt;b&gt;sequel&lt;/b&gt;”. It provides some &lt;b&gt;syntax &lt;/b&gt;which helps you to interact with a &lt;b&gt;database&lt;/b&gt;. These &lt;b&gt;syntax &lt;/b&gt;are very similar to normal English language, so it’s easy to remember and use. Now a day, all major &lt;b&gt;RDBMS (Relational Database Management System)&lt;/b&gt;&amp;nbsp; like &lt;b&gt;MySQL&lt;/b&gt;, &lt;b&gt;Oracle&lt;/b&gt;, &lt;b&gt;postgres&lt;/b&gt;, &lt;b&gt;MS Acces&lt;/b&gt;s and &lt;b&gt;SQL Server &lt;/b&gt;uses &lt;b&gt;SQL &lt;/b&gt;to &lt;b&gt;maintain data&lt;/b&gt;. &lt;br /&gt;&lt;br /&gt;&amp;nbsp; &lt;b&gt;SQL &lt;/b&gt;helps to &lt;b&gt;store, manipulate, read and delete data from data base&lt;/b&gt;. It helps to performs the &lt;b&gt;CRUD(Create, Read, Update &amp;amp; Delete)&lt;/b&gt; operations in &lt;b&gt;RDBMS&lt;/b&gt;. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Create:&lt;/b&gt; It helps to &lt;b&gt;create database&lt;/b&gt;, &lt;b&gt;schema&lt;/b&gt;, &lt;b&gt;table&amp;nbsp; &lt;/b&gt;and &lt;b&gt;view&lt;/b&gt;, along with there &lt;b&gt;properties&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Read:&lt;/b&gt; It helps to &lt;b&gt;select &lt;/b&gt;all information from &lt;b&gt;single or multiple records&lt;/b&gt; from &lt;b&gt;one or many table or view&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Update:&lt;/b&gt; It also helps us to &lt;b&gt;manipulates &lt;/b&gt;existing &lt;b&gt;data &lt;/b&gt;in a &lt;b&gt;database&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Delete: &lt;/b&gt;It can also &lt;b&gt;delete information &lt;/b&gt;or &lt;b&gt;structure &lt;/b&gt;of &lt;b&gt;database &lt;/b&gt;or &lt;b&gt;table&lt;/b&gt;. &lt;/span&gt;&lt;/div&gt;
</description><link>http://interviewquestionjava.blogspot.com/2013/02/sql-what-is-sql.html</link><author>noreply@blogger.com (Anijit Sarkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjWFa-ASZ0m9-JbnO_s6ZxptpMOBe1oxVN9-fofDzWVf7FUQtD_U9hiOUeIs9XbWpE5nBXPB3OmF-6_3U7IchiTh-WI0c3LvMi3ASL46onCeoUCywON7WhqSJoIq30zjgSGrhCa4f2SAI/s72-c/SQL-logo-300x225-2.jpg" height="72" width="72"/><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3166332459178575831.post-4667191677562488768</guid><pubDate>Sun, 10 Feb 2013 16:59:00 +0000</pubDate><atom:updated>2013-02-14T23:39:10.857+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">FRAMEWORK</category><category domain="http://www.blogger.com/atom/ns#">FRAMEWORK INTERVIEW QUESTIONS</category><category domain="http://www.blogger.com/atom/ns#">J2EE</category><category domain="http://www.blogger.com/atom/ns#">J2EE INTERVIEW QUESTIONS</category><category domain="http://www.blogger.com/atom/ns#">JAVA</category><category domain="http://www.blogger.com/atom/ns#">JAVA INTERVIEW QUESTIONS</category><category domain="http://www.blogger.com/atom/ns#">SPRING</category><category domain="http://www.blogger.com/atom/ns#">SPRING INTERVIEW QUESTIONS</category><category domain="http://www.blogger.com/atom/ns#">STRUTS</category><category domain="http://www.blogger.com/atom/ns#">STRUTS INTERVIEW QUESTIONS</category><title>FRAMEWORK: MVC – Model View Controller</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;


&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Model-View-Controller
(MVC) &lt;/b&gt;is a popular &lt;b&gt;Software Architecture pattern&lt;/b&gt; widely used in &lt;b&gt;web
applications&lt;/b&gt;. It separates &lt;b&gt;application data&lt;/b&gt; from &lt;b&gt;UI (user interface) &lt;/b&gt;by a thin
&lt;b&gt;controlling layer&lt;/b&gt;, which actually helps as a bridge between UIs and model. In
this pattern the whole application is separated in 3 layers,&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;mso-list: l0 level1 lfo1; text-indent: -.25in;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;1.&lt;span style=&quot;-moz-font-feature-settings: normal; -moz-font-language-override: normal; font-size-adjust: none; font-size: 7pt; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Models&lt;/b&gt;
are answerable for encapsulating application data, for view to present the data.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;mso-list: l0 level1 lfo1; text-indent: -.25in;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;2.&lt;span style=&quot;-moz-font-feature-settings: normal; -moz-font-language-override: normal; font-size-adjust: none; font-size: 7pt; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Views&lt;/b&gt;
should only present this data, without involving any business logic.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;mso-list: l0 level1 lfo1; text-indent: -.25in;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;3.&lt;span style=&quot;-moz-font-feature-settings: normal; -moz-font-language-override: normal; font-size-adjust: none; font-size: 7pt; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Controllers&lt;/b&gt;
are answerable for receiving requests from users and invoking back-end services
for business process.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;mso-list: l0 level1 lfo1; text-indent: -.25in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://interviewquestionjava.blogspot.com/2013/02/framework-mvc-model-view-controller.html</link><author>noreply@blogger.com (Anijit Sarkar)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3166332459178575831.post-9121687808905229849</guid><pubDate>Mon, 28 Jan 2013 09:50:00 +0000</pubDate><atom:updated>2013-02-14T23:41:50.228+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">FRAMEWORK</category><category domain="http://www.blogger.com/atom/ns#">FRAMEWORK INTERVIEW QUESTIONS</category><category domain="http://www.blogger.com/atom/ns#">HIBERNATE</category><category domain="http://www.blogger.com/atom/ns#">HIBERNATE INTERVIEW QUESTIONS</category><category domain="http://www.blogger.com/atom/ns#">J2EE</category><category domain="http://www.blogger.com/atom/ns#">JAVA</category><category domain="http://www.blogger.com/atom/ns#">JAVA INTERVIEW QUESTIONS</category><category domain="http://www.blogger.com/atom/ns#">SPRING</category><category domain="http://www.blogger.com/atom/ns#">SPRING INTERVIEW QUESTIONS</category><category domain="http://www.blogger.com/atom/ns#">STRUTS</category><category domain="http://www.blogger.com/atom/ns#">STRUTS INTERVIEW QUESTIONS</category><title>FRAMEWORK: WHAT IS FRAMEWORK? WHAT’S THE DIFFERENCE BETWEEN FRAMEWORK AND LIBRARY?</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;br /&gt;&lt;b&gt;Framework:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;A &lt;b&gt;framework &lt;/b&gt;is a &lt;b&gt;basic conceptual&lt;/b&gt; and &lt;b&gt;reusable structure &lt;/b&gt;which provides &lt;b&gt;generic functionality&lt;/b&gt;, used to &lt;b&gt;solve &lt;/b&gt;or &lt;b&gt;address complex issues&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;A software framework&lt;/b&gt; provides &lt;b&gt;basic architecture&lt;/b&gt;, &lt;b&gt;application programming interfaces (APIs)&lt;/b&gt; and tools for building &lt;b&gt;application &lt;/b&gt;and provides required infrastructure.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Library v/s Framework:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Library: Library &lt;/b&gt;or &lt;b&gt;code library&lt;/b&gt; is a &lt;b&gt;collection &lt;/b&gt;of &lt;b&gt;behavior &lt;/b&gt;written is a &lt;b&gt;specific language&lt;/b&gt;, which can be used to &lt;b&gt;execute some function.&lt;/b&gt; You use it the way you want.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Framework: &lt;/b&gt;It controls you. You can’t deviate from the &lt;b&gt;framework rules&lt;/b&gt; and &lt;b&gt;create application&lt;/b&gt;.&lt;/span&gt;&lt;/div&gt;
</description><link>http://interviewquestionjava.blogspot.com/2013/01/struts-what-is-framework-whats.html</link><author>noreply@blogger.com (Anijit Sarkar)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3166332459178575831.post-5626621822865722443</guid><pubDate>Sat, 07 Jul 2012 20:55:00 +0000</pubDate><atom:updated>2014-02-13T13:11:57.161+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">J2EE</category><category domain="http://www.blogger.com/atom/ns#">J2EE INTERVIEW QUESTIONS</category><category domain="http://www.blogger.com/atom/ns#">SERVLET</category><category domain="http://www.blogger.com/atom/ns#">SERVLET INTERVIEW QUESTIONS</category><title>J2EE: SERVLET: doGet() vs. doPost()</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidqAbULulqFWO9ZrPfmbkiGQEqW8kLafZU1Ce2u8LmslldzF2t_O9a4XQk6yXRy6u3HCniXmjO2cqrLuSimXaVpDjT7nD9EfteVESGEYKgi77eSlpmfURlQ7a1iC8j5rVxNh_cKifpRp8/s1600/Java4.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidqAbULulqFWO9ZrPfmbkiGQEqW8kLafZU1Ce2u8LmslldzF2t_O9a4XQk6yXRy6u3HCniXmjO2cqrLuSimXaVpDjT7nD9EfteVESGEYKgi77eSlpmfURlQ7a1iC8j5rVxNh_cKifpRp8/s200/Java4.png&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b&gt;&lt;a href=&quot;http://www.blogger.com/post-edit.g?blogID=3166332459178575831&amp;amp;postID=5626621822865722443&amp;amp;from=pencil&quot; name=&quot;doget&quot;&gt;doGet():&lt;br /&gt;&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;b style=&quot;color: #b45f06;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;protected void doGet(HttpServletRequest req, HttpServletResponse resp)throws ServletException, java.io.IOException&lt;/span&gt;&lt;/b&gt; – is a method of  &lt;b&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-servlet-class-genericservlet-vs.html#HttpServlet&quot; target=&quot;_blank&quot;&gt;Class HttpServlet&lt;/a&gt;&lt;/b&gt;. It is called by the &lt;b&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-web-container-vs-web-server-vs.html#Web%20Server&quot; target=&quot;_blank&quot;&gt;server&lt;/a&gt;&lt;/b&gt; (via the &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-servlet-servlet-life-cycle.html#service&quot; target=&quot;_blank&quot;&gt;service method&lt;/a&gt;) to allow a &lt;b&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-servlet-what-is-servlet.html&quot; target=&quot;_blank&quot;&gt;servlet&lt;/a&gt; &lt;/b&gt;to handle a client&#39;s &lt;b&gt;GET &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/internet-http-request-and-http-response.html#httprequest&quot; target=&quot;_blank&quot;&gt;request&lt;/a&gt;&lt;/b&gt;. &lt;/li&gt;
&lt;li&gt;In &lt;b&gt;doGet()&lt;/b&gt;, the client’s request parameters are appended to the &lt;b&gt;URL&lt;/b&gt; and sent along with &lt;b&gt;header information&lt;/b&gt;.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;doGet()&lt;/b&gt; is not a secured process because the request parameters are clearly visible in the URL.&lt;/li&gt;
&lt;li&gt;Since request parameters are sent along with header information, so only a limited amount of data should be sent. &lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.blogger.com/post-edit.g?blogID=3166332459178575831&amp;amp;postID=5626621822865722443&amp;amp;from=pencil&quot; name=&quot;dopost&quot;&gt;&lt;b&gt;doPost():&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException&lt;/span&gt;&lt;/b&gt; – is a method of &lt;b&gt;Class &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-servlet-class-genericservlet-vs.html#HttpServlet&quot; target=&quot;_blank&quot;&gt;HttpServlet&lt;/a&gt;&lt;/b&gt;. It is called by the &lt;b&gt;server&lt;/b&gt; (via the service method) to allow a servlet to handle a POST request.&lt;/li&gt;
&lt;li&gt;In &lt;b&gt;doPost()&lt;/b&gt;, the client’s request parameters are submitted via form.&lt;/li&gt;
&lt;li&gt;As in &lt;b&gt;doPost()&lt;/b&gt;, client’s request parameters are sent via form body, the parameters’ values are not visible in any where, so its safe and secure.&lt;/li&gt;
&lt;li&gt;This method allows the client to send data of unlimited length to the &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-web-container-vs-web-server-vs.html#Web%20Server&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;Web server&lt;/b&gt;&lt;/a&gt; a single.&lt;/li&gt;
&lt;/ul&gt;



&lt;a href=&quot;https://plus.google.com/+AnijitSarkar?rel=author&quot; class=&quot;auth_style&quot;&gt;Anijit Sarkar&lt;/a&gt;
&lt;/div&gt;</description><link>http://interviewquestionjava.blogspot.com/2012/07/j2ee-servlet-doget-vs-dopost.html</link><author>noreply@blogger.com (Anijit Sarkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidqAbULulqFWO9ZrPfmbkiGQEqW8kLafZU1Ce2u8LmslldzF2t_O9a4XQk6yXRy6u3HCniXmjO2cqrLuSimXaVpDjT7nD9EfteVESGEYKgi77eSlpmfURlQ7a1iC8j5rVxNh_cKifpRp8/s72-c/Java4.png" height="72" width="72"/><thr:total>14</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3166332459178575831.post-9040580113290213958</guid><pubDate>Mon, 05 Mar 2012 11:58:00 +0000</pubDate><atom:updated>2015-07-02T18:11:04.103+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">JAVA</category><category domain="http://www.blogger.com/atom/ns#">JAVA INTERVIEW QUESTIONS</category><title>JAVA: What is the superclass of Exception</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;java.lang.Throwable&lt;/b&gt; is the &lt;b&gt;superclass &lt;/b&gt;of all the &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/01/java-what-is-difference-between-error.html&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;errors &lt;/b&gt;&lt;/a&gt;and &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/01/java-what-is-difference-between-error.html&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;exceptions &lt;/b&gt;&lt;/a&gt;in &lt;b&gt;java&lt;/b&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;/span&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgz7Q1cM3VVnIcKOGG80rW7bzq91fNmFqzwmyRWdwqC8mQGcyokfjsGSkIAupj21Ccw1LSrllHC23i_B8Gv8u5yDJM-0mr5DrN1D6qbYkmx1nLilkXBoqiOWqtHrdL8nLnRwTc9oUJs7Jo/s1600/exception_hiererchy.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;183&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgz7Q1cM3VVnIcKOGG80rW7bzq91fNmFqzwmyRWdwqC8mQGcyokfjsGSkIAupj21Ccw1LSrllHC23i_B8Gv8u5yDJM-0mr5DrN1D6qbYkmx1nLilkXBoqiOWqtHrdL8nLnRwTc9oUJs7Jo/s320/exception_hiererchy.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://interviewquestionjava.blogspot.com/2012/03/java-what-is-superclass-of-exception.html</link><author>noreply@blogger.com (Anijit Sarkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgz7Q1cM3VVnIcKOGG80rW7bzq91fNmFqzwmyRWdwqC8mQGcyokfjsGSkIAupj21Ccw1LSrllHC23i_B8Gv8u5yDJM-0mr5DrN1D6qbYkmx1nLilkXBoqiOWqtHrdL8nLnRwTc9oUJs7Jo/s72-c/exception_hiererchy.png" height="72" width="72"/><thr:total>6</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3166332459178575831.post-8300772426971756483</guid><pubDate>Mon, 05 Mar 2012 11:56:00 +0000</pubDate><atom:updated>2012-03-05T17:26:45.298+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">JAVA</category><category domain="http://www.blogger.com/atom/ns#">JAVA INTERVIEW QUESTIONS</category><title>JAVA: Why Errors are Unchecked?</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:WordDocument&gt;   &lt;w:View&gt;Normal&lt;/w:View&gt;   &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:PunctuationKerning/&gt;   &lt;w:ValidateAgainstSchemas/&gt;   &lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:Compatibility&gt;    &lt;w:BreakWrappedTables/&gt;    &lt;w:SnapToGridInCell/&gt;    &lt;w:WrapTextWithPunct/&gt;    &lt;w:UseAsianBreakRules/&gt;    &lt;w:DontGrowAutofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:BrowserLevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:LatentStyles DefLockedState=&quot;false&quot; LatentStyleCount=&quot;156&quot;&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;
 /* Style Definitions */
 table.MsoNormalTable
 {mso-style-name:&quot;Table Normal&quot;;
 mso-tstyle-rowband-size:0;
 mso-tstyle-colband-size:0;
 mso-style-noshow:yes;
 mso-style-parent:&quot;&quot;;
 mso-padding-alt:0in 5.4pt 0in 5.4pt;
 mso-para-margin:0in;
 mso-para-margin-bottom:.0001pt;
 mso-pagination:widow-orphan;
 font-size:10.0pt;
 font-family:&quot;Times New Roman&quot;;
 mso-ansi-language:#0400;
 mso-fareast-language:#0400;
 mso-bidi-language:#0400;}
&lt;/style&gt; &lt;![endif]--&gt;  &lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/01/java-what-is-difference-between-error.html&quot; target=&quot;_blank&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Error&lt;/b&gt;&lt;/a&gt; is unpredictable. It can occur at any point and recover is also quite impossible. So it is meaningless to declare such exception. That’s why, in java, &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;error is &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/01/java-checked-and-unchecked-exception.html&quot; target=&quot;_blank&quot;&gt;unchecked&lt;/a&gt;&lt;/b&gt;. &lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;</description><link>http://interviewquestionjava.blogspot.com/2012/03/java-why-errors-are-unchecked.html</link><author>noreply@blogger.com (Anijit Sarkar)</author><thr:total>6</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3166332459178575831.post-4169880898246952168</guid><pubDate>Wed, 29 Feb 2012 20:25:00 +0000</pubDate><atom:updated>2014-02-13T13:12:14.729+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">J2EE</category><category domain="http://www.blogger.com/atom/ns#">J2EE INTERVIEW QUESTIONS</category><category domain="http://www.blogger.com/atom/ns#">SERVLET</category><category domain="http://www.blogger.com/atom/ns#">SERVLET INTERVIEW QUESTIONS</category><title>J2EE: SERVLET: Class GenericServlet vs Class HttpServlet</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; name=&quot;GenericServlet&quot;&gt;Class GenericServlet :&amp;nbsp; &lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTTRjxRhQocSgEDTcUDRqAPURryjJk7hVHgVZzwrif_LiRhXeupMQiJWhNkewrQNDdnwerceOTZX2Jzaw31_PFoDtPKdVpf1JTFl1Hh8ia1abngU8ANoGjdz6Sq5ZHQx2zacp8Rymxgs0/s1600/Java3.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTTRjxRhQocSgEDTcUDRqAPURryjJk7hVHgVZzwrif_LiRhXeupMQiJWhNkewrQNDdnwerceOTZX2Jzaw31_PFoDtPKdVpf1JTFl1Hh8ia1abngU8ANoGjdz6Sq5ZHQx2zacp8Rymxgs0/s200/Java3.png&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .5in; mso-list: l0 level1 lfo1; tab-stops: list .75in; text-indent: -.25in;&quot;&gt;
&lt;span style=&quot;font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;It is an &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;abstract class&lt;/b&gt; which defines a &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;generic&lt;/b&gt; and &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;protocol independent servlet&lt;/b&gt;. Here, &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;protocol independent means&lt;/b&gt;, by default, it doesn’t contain inherent support for any particular type of protocol, but it can be extended to provide implementation of any protocol.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .5in; tab-stops: list .75in; text-indent: -.25in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .5in; mso-list: l0 level1 lfo1; tab-stops: list .75in; text-indent: -.25in;&quot;&gt;
&lt;span style=&quot;font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Class GenericServlet&lt;/b&gt; implements &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-servlet-what-is-servlet-interface.html&quot; target=&quot;_blank&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Interface Servlet&lt;/b&gt;&lt;/a&gt; and &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Interface ServletConfig&lt;/b&gt;&amp;nbsp; and it belongs to &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-servlet-servlet-api.html&quot; target=&quot;_blank&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;javax.servlet package&lt;/b&gt;&lt;/a&gt;.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .5in; tab-stops: list .75in; text-indent: -.25in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .5in; mso-list: l0 level1 lfo1; tab-stops: list .75in; text-indent: -.25in;&quot;&gt;
&lt;span style=&quot;font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;It offers simpler version of the &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-servlet-servlet-life-cycle.html&quot; target=&quot;_blank&quot;&gt;servlet life cycle&lt;/a&gt; methods&lt;/b&gt; &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;init()&lt;/b&gt; and &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;destroy()&lt;/b&gt; and the &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;methods of ServletConfig&lt;/b&gt;. That’s why, it makes writing a &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-servlet-what-is-servlet.html&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;servlet&lt;/b&gt;&lt;/a&gt; easier.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .5in; tab-stops: list .75in; text-indent: -.25in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .5in; mso-list: l0 level1 lfo1; tab-stops: list .75in; text-indent: -.25in;&quot;&gt;
&lt;span style=&quot;font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;Here, the method &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;service(ServletRequest req, ServletResponse res)&lt;/b&gt; is &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;abstract&lt;/b&gt;, so the subclasses must &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/01/what-is-method-overriding.html&quot; target=&quot;_blank&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;override&lt;/b&gt;&lt;/a&gt; it. And this is also the reason why the &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;GenericServlet&lt;/b&gt; is an &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;abstract class&lt;/b&gt;.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .25in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .25in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;code&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3166332459178575831&quot; name=&quot;HttpServlet&quot;&gt;Class HttpServlet&lt;/a&gt;&lt;/span&gt;&lt;/b&gt;&lt;/code&gt;&lt;code&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; font-size: 10pt;&quot;&gt; :&lt;/span&gt;&lt;/b&gt;&lt;/code&gt;&lt;code&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;/b&gt;&lt;/code&gt;&lt;code&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .25in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .5in; mso-list: l1 level1 lfo2; tab-stops: list .5in; text-indent: -.25in;&quot;&gt;
&lt;span style=&quot;font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;It is also an &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;abstract class&lt;/b&gt; which defines &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;HTTP prototype dependent servlet&lt;/b&gt;. That means we need to extend it to write a &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/internet-http-vs-https.html&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;HTTP&lt;/b&gt;&lt;/a&gt; &lt;b&gt;servlet&lt;/b&gt; for the use of the web.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .5in; tab-stops: list .5in; text-indent: -.25in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .5in; mso-list: l1 level1 lfo2; tab-stops: list .5in; text-indent: -.25in;&quot;&gt;
&lt;span style=&quot;font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Class HttpServlet&lt;/b&gt; is a subclass of &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Class GenericServlet&lt;/b&gt; and it belongs to &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-servlet-servlet-api.html&quot; target=&quot;_blank&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;javax.servlet.http&lt;/b&gt;&lt;b&gt; package.&lt;/b&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .5in; tab-stops: list .5in; text-indent: -.25in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .5in; mso-list: l1 level1 lfo2; tab-stops: list .5in; text-indent: -.25in;&quot;&gt;
&lt;span style=&quot;font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;As it’s an &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;abstract class&lt;/b&gt;, a &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;subclass&lt;/b&gt; of it &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;must override at least 1 method&lt;/b&gt;, generally one of these &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;doGet(), doPost(), doPut(), doDelete(), init(), destroy(), getServletInfo()&lt;/b&gt;.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .5in; tab-stops: list .5in; text-indent: -.25in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .5in; mso-list: l1 level1 lfo2; tab-stops: list .5in; text-indent: -.25in;&quot;&gt;
&lt;span style=&quot;font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Class HttpServlet&lt;/b&gt; has two service() methods - one is &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;public void service(ServletRequest req, ServletResponse res) &lt;/b&gt;which dispatches client request to &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;protected void&lt;/b&gt; &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;service(ServletRequest req, ServletResponse resp) &lt;/b&gt;which again dispaches the request to the doXXX methods (like&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt; doGet()&lt;/b&gt;,&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt; doPost()&lt;/b&gt;,&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt; &lt;/b&gt;etc.).&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 0.5in; text-indent: -0.25in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEid_oQh6CVNW9J8WgNGCKMcrG0NjnnPd7aCf-Sr6XNrhkgBMl1gFENcOcwXU-ikLWUBtcLvPe-PAe7wfmAlPK6EpT0ICLV0QL64mXKCylatgwi_fhGATdXFPRQKgAx3jo7Buo0HY30vk_U/s1600/Class+GenericServlet+vs+Class+HttpServlet.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEid_oQh6CVNW9J8WgNGCKMcrG0NjnnPd7aCf-Sr6XNrhkgBMl1gFENcOcwXU-ikLWUBtcLvPe-PAe7wfmAlPK6EpT0ICLV0QL64mXKCylatgwi_fhGATdXFPRQKgAx3jo7Buo0HY30vk_U/s1600/Class+GenericServlet+vs+Class+HttpServlet.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #274e13;&quot;&gt;&lt;u&gt;&lt;i&gt;&lt;b&gt;A servlet hierarchy&lt;/b&gt;&lt;/i&gt;&lt;/u&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 0.5in; text-indent: -0.25in;&quot;&gt;
&lt;/div&gt;
&lt;table align=&quot;left&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;   &lt;td height=&quot;116&quot; width=&quot;289&quot;&gt;&lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&amp;nbsp;  &lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://plus.google.com/+AnijitSarkar?rel=author&quot; class=&quot;auth_style&quot;&gt;Anijit Sarkar&lt;/a&gt;
&lt;/div&gt;</description><link>http://interviewquestionjava.blogspot.com/2012/02/j2ee-servlet-class-genericservlet-vs.html</link><author>noreply@blogger.com (Anijit Sarkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTTRjxRhQocSgEDTcUDRqAPURryjJk7hVHgVZzwrif_LiRhXeupMQiJWhNkewrQNDdnwerceOTZX2Jzaw31_PFoDtPKdVpf1JTFl1Hh8ia1abngU8ANoGjdz6Sq5ZHQx2zacp8Rymxgs0/s72-c/Java3.png" height="72" width="72"/><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3166332459178575831.post-5971332952978818334</guid><pubDate>Tue, 28 Feb 2012 21:28:00 +0000</pubDate><atom:updated>2014-02-13T13:12:24.744+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">J2EE</category><category domain="http://www.blogger.com/atom/ns#">J2EE INTERVIEW QUESTIONS</category><category domain="http://www.blogger.com/atom/ns#">SERVLET</category><category domain="http://www.blogger.com/atom/ns#">SERVLET INTERVIEW QUESTIONS</category><title>J2EE: SERVLET: What is Servlet Interface?</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVd5xVD70BtFDz_TWL9NYnuiaDsgDrA2hnoNwA5dgHhZH19ZQtLxxvxisZc23KmcmWBZ9We8UcvQdeMSP9HT0q7Z4mAuZ9_0r1VMkNqI-zBDPNFvndPCczvSJw-C1TBCXXRc0Mq4ysysg/s1600/Java7.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVd5xVD70BtFDz_TWL9NYnuiaDsgDrA2hnoNwA5dgHhZH19ZQtLxxvxisZc23KmcmWBZ9We8UcvQdeMSP9HT0q7Z4mAuZ9_0r1VMkNqI-zBDPNFvndPCczvSJw-C1TBCXXRc0Mq4ysysg/s200/Java7.png&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Interface javax.servlet.Servlet&lt;/b&gt; is that interface which defines the &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-servlet-servlet-life-cycle.html&quot; target=&quot;_blank&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;ServletLife Cycle&lt;/b&gt;&lt;/a&gt; methods. So, all &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;servlets&lt;/b&gt; must implement this interface, either directly or by extending a class which implements this interface. Instead of directly implementing the &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Servlet Interface&lt;/b&gt;, a &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-servlet-what-is-servlet.html&quot; target=&quot;_blank&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;servlet&lt;/b&gt;&lt;/a&gt; can also extend &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-servlet-class-genericservlet-vs.html&quot; target=&quot;_blank&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Class GenericServlet&lt;/b&gt; &lt;/a&gt;(which implements &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Servlet Interface&lt;/b&gt;), or can extend &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-servlet-class-genericservlet-vs.html&quot; target=&quot;_blank&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;HttpServlet Class&lt;/b&gt; &lt;/a&gt;(which extends the &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;GenericServlet class&lt;/b&gt;).&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Methods of Interface Servlet:&lt;/b&gt;&lt;/div&gt;
&lt;ul style=&quot;margin-top: 0in;&quot; type=&quot;disc&quot;&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;mso-list: l0 level1 lfo1; tab-stops: list .5in;&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;init(ServletConfig config) : &lt;/b&gt;Called      by the &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-web-container-vs-web-server-vs.html&quot; target=&quot;_blank&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Web Container&lt;/b&gt;&lt;/a&gt; to      initialize a &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;servlet&lt;/b&gt;. Here, &lt;code&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;config&lt;/span&gt;&lt;/b&gt;&lt;/code&gt;&amp;nbsp; is a &lt;code&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;ServletConfig&lt;/span&gt;&lt;/b&gt;&lt;/code&gt; &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;object&lt;/b&gt; containing the servlet&#39;s      configuration and initialization parameters &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .25in;&quot;&gt;
&lt;!-- Clicksor.COM --&gt;&lt;br /&gt;
&lt;a href=&quot;http://signup.clicksor.com/new_aa_site.php?srid=21202889&quot; target=&quot;_new&quot;&gt;&lt;br /&gt;
&lt;img border=&quot;0&quot; src=&quot;http://signup.clicksor.com/publisher/images/ad/468x60_1.gif&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;!-- Clicksor.COM --&gt;&lt;br /&gt;&lt;/div&gt;
&lt;ul style=&quot;margin-top: 0in;&quot; type=&quot;disc&quot;&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;mso-list: l0 level1 lfo1; tab-stops: list .5in;&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;service(ServletRequest req, ServletResponse      res) : &lt;/b&gt;Called by the &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Web      Container&lt;/b&gt; to allow a &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;servlet&lt;/b&gt;      to respond to a request. Here, &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;req&lt;/b&gt;      is the &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;ServletRequest object&lt;/b&gt;      that contains the client&#39;s request and &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;res&lt;/b&gt; is the &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;ServletResponse      object&lt;/b&gt; that contains the servlet&#39;s response.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;ul style=&quot;margin-top: 0in;&quot; type=&quot;disc&quot;&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;mso-list: l0 level1 lfo1; tab-stops: list .5in;&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;destroy() : &lt;/b&gt;Called by the &lt;b&gt;Web      Container&lt;/b&gt; to clean up a servlet’s service.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;ul style=&quot;margin-top: 0in;&quot; type=&quot;disc&quot;&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;mso-list: l0 level1 lfo1; tab-stops: list .5in;&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;getServletConfig() : &lt;/b&gt;Return a      &lt;b&gt;ServletConfig object&lt;/b&gt;, which contain the initialization parameter and startup      configuration of a servlet.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;ul style=&quot;margin-top: 0in;&quot; type=&quot;disc&quot;&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;mso-list: l0 level1 lfo1; tab-stops: list .5in;&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;getServletInfo() : &lt;/b&gt;Returns a &lt;b&gt;     string&lt;/b&gt; containing the details of a servlet, like author, version and      copyright.&lt;/li&gt;
&lt;/ul&gt;


&lt;a href=&quot;https://plus.google.com/+AnijitSarkar?rel=author&quot; class=&quot;auth_style&quot;&gt;Anijit Sarkar&lt;/a&gt;
&lt;/div&gt;</description><link>http://interviewquestionjava.blogspot.com/2012/02/j2ee-servlet-what-is-servlet-interface.html</link><author>noreply@blogger.com (Anijit Sarkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVd5xVD70BtFDz_TWL9NYnuiaDsgDrA2hnoNwA5dgHhZH19ZQtLxxvxisZc23KmcmWBZ9We8UcvQdeMSP9HT0q7Z4mAuZ9_0r1VMkNqI-zBDPNFvndPCczvSJw-C1TBCXXRc0Mq4ysysg/s72-c/Java7.png" height="72" width="72"/><thr:total>6</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3166332459178575831.post-7268818629879768356</guid><pubDate>Mon, 27 Feb 2012 08:52:00 +0000</pubDate><atom:updated>2014-02-13T13:12:34.904+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">J2EE</category><category domain="http://www.blogger.com/atom/ns#">J2EE INTERVIEW QUESTIONS</category><category domain="http://www.blogger.com/atom/ns#">SERVLET</category><category domain="http://www.blogger.com/atom/ns#">SERVLET INTERVIEW QUESTIONS</category><title>J2EE: SERVLET: What is Servlet?</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;code&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;Servlet:&lt;/span&gt;&lt;/b&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBeWqaz41CtUqtedRty_-ub_wpfH5-JAA8yKA-Hroe_aq1ZRa_lWKEZol744zcUStDaQqH9HtU52Q_GCda5LAtFJC6poten-9dl4a9tiKvRCRgsPRBYicFDGLef1bR581TnuhyF-LezEc/s1600/java-ee-6-logo.gif&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;178&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBeWqaz41CtUqtedRty_-ub_wpfH5-JAA8yKA-Hroe_aq1ZRa_lWKEZol744zcUStDaQqH9HtU52Q_GCda5LAtFJC6poten-9dl4a9tiKvRCRgsPRBYicFDGLef1bR581TnuhyF-LezEc/s200/java-ee-6-logo.gif&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;code&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;Servlet&lt;/span&gt;&lt;/b&gt;&lt;/code&gt;&lt;code&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; is a &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;server-side&lt;/b&gt; (runs within a Web server), &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Java Programming Language Class&lt;/b&gt; which interacts with clients via &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;request-response programming model (example, &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/internet-http-request-and-http-response.html&quot; target=&quot;_blank&quot;&gt;HTTP Request-Response model&lt;/a&gt;).&lt;/b&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;code&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;It can respond to any type of request, but, generally, it is used to extend the application hosted by &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-web-container-vs-web-server-vs.html&quot; target=&quot;_blank&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Web Server&lt;/b&gt;&lt;/a&gt; by providing &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;dynamic web content&lt;/b&gt;.&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;code&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;It has &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;build-in&lt;/b&gt; &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;threading capability&lt;/b&gt; and provides a &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;secure environment for programming&lt;/b&gt;. &lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-servlet-servlet-api.html&quot; target=&quot;_blank&quot;&gt;&lt;code&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;Java Servlet API&lt;/span&gt;&lt;/b&gt;&lt;/code&gt;&lt;/a&gt;&lt;code&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; provides &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;javax.servlet&lt;/b&gt; and &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;javax.servlet.http&lt;/b&gt; packages offer necessary classes and interfaces for writing servlets. All Servlets must implement &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-servlet-what-is-servlet-interface.html&quot; target=&quot;_blank&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Interface Servlet&lt;/b&gt;&lt;/a&gt;, which contains the &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-servlet-servlet-life-cycle.html&quot; target=&quot;_blank&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;servlet life-cycle&lt;/b&gt;&lt;/a&gt; methods.&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;code&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;To implement a generic service we can extend &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-servlet-class-genericservlet-vs.html&quot; target=&quot;_blank&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Class GenericServlet&lt;/b&gt;&lt;/a&gt;, which defines a generic, protocol-independent servlet. And to write an HTTP servlet for use on the Web, we can extend &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-servlet-class-genericservlet-vs.html&quot; target=&quot;_blank&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Class HttpServlet&lt;/b&gt;&lt;/a&gt;, which provides methods, such as &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;doGet()&lt;/b&gt; and &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;doPost()&lt;/b&gt;, for handling HTTP-specific services.&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;


&lt;a href=&quot;https://plus.google.com/+AnijitSarkar?rel=author&quot; class=&quot;auth_style&quot;&gt;Anijit Sarkar&lt;/a&gt;
&lt;/div&gt;</description><link>http://interviewquestionjava.blogspot.com/2012/02/j2ee-servlet-what-is-servlet.html</link><author>noreply@blogger.com (Anijit Sarkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBeWqaz41CtUqtedRty_-ub_wpfH5-JAA8yKA-Hroe_aq1ZRa_lWKEZol744zcUStDaQqH9HtU52Q_GCda5LAtFJC6poten-9dl4a9tiKvRCRgsPRBYicFDGLef1bR581TnuhyF-LezEc/s72-c/java-ee-6-logo.gif" height="72" width="72"/><thr:total>201</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3166332459178575831.post-4611009464081413418</guid><pubDate>Fri, 24 Feb 2012 05:47:00 +0000</pubDate><atom:updated>2012-02-24T11:18:05.932+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">JAVA</category><category domain="http://www.blogger.com/atom/ns#">JAVA INTERVIEW QUESTIONS</category><title>JAVA: Why can’t enum extends any other class?</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;By default, all &lt;b&gt;enum&lt;/b&gt;s implicitly extend &lt;b&gt;java.lang.Enum&lt;/b&gt;. And as we know, Java doesn&#39;t support &lt;b&gt;multiple inheritance&lt;/b&gt;, an &lt;b&gt;enum&lt;/b&gt; cannot extend any other class.&lt;/div&gt;</description><link>http://interviewquestionjava.blogspot.com/2012/02/java-why-cant-enum-extends-any-other.html</link><author>noreply@blogger.com (Anijit Sarkar)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3166332459178575831.post-834341963860972656</guid><pubDate>Sun, 19 Feb 2012 21:38:00 +0000</pubDate><atom:updated>2014-02-13T13:12:44.280+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">J2EE</category><category domain="http://www.blogger.com/atom/ns#">J2EE INTERVIEW QUESTIONS</category><category domain="http://www.blogger.com/atom/ns#">SERVLET</category><category domain="http://www.blogger.com/atom/ns#">SERVLET INTERVIEW QUESTIONS</category><title>J2EE: SERVLET: SERVLET API</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUxDPbOlDsk8KlydHPv5SnJPzF-pvJKOL1bV5wSgAnVi_rHyeWcDEiJPeb0AzDs-qcqpeh36XHLXfwREJCXAe16L1Brml1ef_2z3TembQakuwEHgkiN94QGpr24Ca5yrCbLXYfBSDXOT8/s1600/java.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUxDPbOlDsk8KlydHPv5SnJPzF-pvJKOL1bV5wSgAnVi_rHyeWcDEiJPeb0AzDs-qcqpeh36XHLXfwREJCXAe16L1Brml1ef_2z3TembQakuwEHgkiN94QGpr24Ca5yrCbLXYfBSDXOT8/s200/java.png&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&amp;nbsp;&amp;nbsp; Java Servlet API&lt;/b&gt; is that &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Application Program Interface (&lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/01/what-is-java-api.html&quot; target=&quot;_blank&quot;&gt;API&lt;/a&gt;)&lt;/b&gt;, which defines and describes the contracts between &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-servlet-what-is-servlet.html&quot; target=&quot;_blank&quot;&gt;servlets&lt;/a&gt; &lt;/b&gt;and &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-web-container-vs-web-server-vs.html#Web%20Server%20/%20HTTP%20Server&quot; target=&quot;_blank&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;servers&lt;/b&gt;&lt;/a&gt;. That means, it contains the set of programs and standard instructions to develop a proper access between a &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;servlet&lt;/b&gt; and the &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;server&lt;/b&gt;. &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Servlet API&lt;/b&gt; is a part of the official &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;J2EE API&lt;/b&gt;. This API contains 2 packages with the extension &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;javax&lt;/b&gt;. They are as follows.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .75in; mso-list: l2 level1 lfo1; tab-stops: list .75in; text-indent: -.25in;&quot;&gt;
&lt;span style=&quot;font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Package javax.servlet&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .75in; mso-list: l2 level1 lfo1; tab-stops: list .75in; text-indent: -.25in;&quot;&gt;
&lt;span style=&quot;font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Package javax.servlet.http&lt;/b&gt;&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Package javax.servlet: &lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;ul style=&quot;margin-top: 0in;&quot; type=&quot;disc&quot;&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;mso-list: l1 level1 lfo2; tab-stops: list .5in;&quot;&gt;&lt;b&gt;Package      javax.servlet&lt;/b&gt; deals with the contracts between a &lt;b&gt;servlet class&lt;/b&gt; and the      &lt;b&gt;runtime environment&lt;/b&gt; offered for an instance of the class, within the      &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-web-container-vs-web-server-vs.html#Web%20Container%20/%20Servlet%20Container%20/%20Servlet%20Engine&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;servlet container&lt;/b&gt;&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;ul style=&quot;margin-top: 0in;&quot; type=&quot;disc&quot;&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;mso-list: l1 level1 lfo2; tab-stops: list .5in;&quot;&gt;It      contains a set of classes and interfaces. Some important classes and      interfaces like, &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-servlet-class-genericservlet-vs.html&quot; target=&quot;_blank&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Class GenericServlet&lt;/b&gt;&lt;/a&gt;      which implements &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-servlet-what-is-servlet-interface.html&quot; target=&quot;_blank&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Interface Servlet&lt;/b&gt;&lt;/a&gt;.      Apart from that, interfaces like &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Filter&lt;/b&gt;,      &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;RequestDispatcher&lt;/b&gt;, &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;ServletRequest&lt;/b&gt;, &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;ServletResponse&lt;/b&gt;, etc. and classes      like &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;ServletInputStream&lt;/b&gt;, &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;ServletOutputStream&lt;/b&gt;, etc are also belong      of this package. It also contains 2 exceptions, and they are &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;ServletException&lt;/b&gt; and &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;UnavailableException&lt;/b&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Package javax.servlet.http:&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;ul style=&quot;margin-top: 0in;&quot; type=&quot;disc&quot;&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;mso-list: l1 level1 lfo2; tab-stops: list .5in;&quot;&gt;&lt;b&gt;Package      javax.servlet.http&lt;/b&gt; deals with the contracts between a &lt;b&gt;servlet class&lt;/b&gt;, which      is running under &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/internet-http-request-and-http-response.html#HTTP&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;HTTP protocol&lt;/b&gt;&lt;/a&gt; and the &lt;b&gt;runtime environment&lt;/b&gt; offered for an      instance of the class, within the &lt;b&gt;servlet container&lt;/b&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;ul style=&quot;margin-top: 0in;&quot; type=&quot;disc&quot;&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;mso-list: l1 level1 lfo2; tab-stops: list .5in;&quot;&gt;It      also contains some important classes and interfaces. Some of them are, Interfaces      like &lt;b&gt;HttpSession&lt;/b&gt;, &lt;b&gt;HttpServletResponse&lt;/b&gt;, &lt;b&gt;HttpServletRequest&lt;/b&gt;, &lt;b&gt;HttpSessionBindingListener&lt;/b&gt;,      etc and classes like &lt;b&gt;Cookie&lt;/b&gt;, &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-servlet-class-genericservlet-vs.html&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;HttpServlet&lt;/b&gt;&lt;/a&gt; (which implements &lt;b&gt;Interface      Servlet&lt;/b&gt; of&lt;b&gt; javax.servlet package&lt;/b&gt;), etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;body&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;body&quot;&gt;
&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Uses of Servlet API:&lt;/b&gt;&lt;/div&gt;
&lt;ol start=&quot;1&quot; type=&quot;1&quot;&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;mso-list: l0 level1 lfo3; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;&quot;&gt;Management of &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-servlet-servlet-life-cycle.html&quot; target=&quot;_blank&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Servlet life cycle&lt;/b&gt;&lt;/a&gt;.&lt;/li&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;mso-list: l0 level1 lfo3; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;&quot;&gt;It provides access to &lt;b&gt;servlet      context&lt;/b&gt;.&lt;/li&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;mso-list: l0 level1 lfo3; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;&quot;&gt;It also provides some &lt;b&gt;utility      classes&lt;/b&gt;. &lt;/li&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;mso-list: l0 level1 lfo3; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;&quot;&gt;And last but not least, it      also provides classes to handle &lt;b&gt;HTTP protocol&lt;/b&gt;.&lt;span id=&quot;goog_427774832&quot;&gt;&lt;/span&gt;&lt;span id=&quot;goog_427774833&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;



&lt;a href=&quot;https://plus.google.com/+AnijitSarkar?rel=author&quot; class=&quot;auth_style&quot;&gt;Anijit Sarkar&lt;/a&gt;
&lt;/div&gt;</description><link>http://interviewquestionjava.blogspot.com/2012/02/j2ee-servlet-servlet-api.html</link><author>noreply@blogger.com (Anijit Sarkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUxDPbOlDsk8KlydHPv5SnJPzF-pvJKOL1bV5wSgAnVi_rHyeWcDEiJPeb0AzDs-qcqpeh36XHLXfwREJCXAe16L1Brml1ef_2z3TembQakuwEHgkiN94QGpr24Ca5yrCbLXYfBSDXOT8/s72-c/java.png" height="72" width="72"/><thr:total>37</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3166332459178575831.post-5060104569335909587</guid><pubDate>Thu, 16 Feb 2012 22:22:00 +0000</pubDate><atom:updated>2014-02-13T13:12:55.854+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">J2EE</category><category domain="http://www.blogger.com/atom/ns#">J2EE INTERVIEW QUESTIONS</category><category domain="http://www.blogger.com/atom/ns#">SERVLET</category><category domain="http://www.blogger.com/atom/ns#">SERVLET INTERVIEW QUESTIONS</category><title>J2EE: SERVLET: What happens to Session if the client intentionally turns off the cookies?</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .25in;&quot;&gt;&amp;nbsp;&amp;nbsp; If &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;client&lt;/b&gt; intentionally &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;turns off&lt;/b&gt; the &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;cookies&lt;/b&gt;, that means, the client chooses not to join the &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-servlet-session-tracking-in.html&quot; target=&quot;_blank&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;session&lt;/b&gt;&lt;/a&gt;. In this situation, until the client &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;turns on&lt;/b&gt; the &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;cookies&lt;/b&gt;, &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;getSession&lt;/b&gt; will return a different &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;session&lt;/b&gt; on each request, and &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;isNew&lt;/b&gt; will always return true.&lt;/div&gt;

&lt;a href=&quot;https://plus.google.com/+AnijitSarkar?rel=author&quot; class=&quot;auth_style&quot;&gt;Anijit Sarkar&lt;/a&gt;
&lt;/div&gt;</description><link>http://interviewquestionjava.blogspot.com/2012/02/j2ee-servlet-what-happens-to.html</link><author>noreply@blogger.com (Anijit Sarkar)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3166332459178575831.post-1971861836151605867</guid><pubDate>Thu, 16 Feb 2012 22:01:00 +0000</pubDate><atom:updated>2014-02-13T13:13:07.727+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">J2EE</category><category domain="http://www.blogger.com/atom/ns#">J2EE INTERVIEW QUESTIONS</category><category domain="http://www.blogger.com/atom/ns#">SERVLET</category><category domain="http://www.blogger.com/atom/ns#">SERVLET INTERVIEW QUESTIONS</category><title>J2EE: SERVLET: Session Tracking in Servlets using Interface HttpSession</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimCucHdAQldEu1iE7aU1BbWu_oiR_IkGnD_vkoQVjcuQk4Ob4yQR_f9V2NXJe_uFu4RzjyuVKKm0RItkUVU0izy7l-52l_FY-1EKfSvvmZkYz2n1fLRSVcctWBsjPvZz6QA_t1v9hDE60/s1600/Apps-preferences-web-browser-cookies-icon.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimCucHdAQldEu1iE7aU1BbWu_oiR_IkGnD_vkoQVjcuQk4Ob4yQR_f9V2NXJe_uFu4RzjyuVKKm0RItkUVU0izy7l-52l_FY-1EKfSvvmZkYz2n1fLRSVcctWBsjPvZz6QA_t1v9hDE60/s200/Apps-preferences-web-browser-cookies-icon.png&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ul style=&quot;margin-top: 0in;&quot; type=&quot;disc&quot;&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;mso-list: l0 level1 lfo1; tab-stops: list .5in;&quot;&gt;&lt;b&gt;&lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/internet-importance-types-of-session.html&quot; target=&quot;_blank&quot;&gt;Session      tracking&lt;/a&gt; in &lt;a href=&quot;http://interviewquestionjava.blogspot.in/2012/02/j2ee-servlet-what-is-servlet.html&quot; target=&quot;_blank&quot;&gt;Servlets&lt;/a&gt;&lt;/b&gt; is done      by using &lt;b&gt;Interface HttpSession&lt;/b&gt;. It helps to identify a client throughout      many page requests or visiting a website and to store details about that client.      &lt;/li&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;mso-list: l0 level1 lfo1; tab-stops: list .5in;&quot;&gt;Whenever a request arrives, it checks      for the preexisting &lt;b&gt;session object&lt;/b&gt;, to fetch details of the client      from there, else, if its first request from a new client, its simple      creates a &lt;b&gt;session object&lt;/b&gt; for that client. These &lt;b&gt;session objects&lt;/b&gt;      are simple &lt;b&gt;java objects&lt;/b&gt;.&lt;/li&gt;
&lt;li class=&quot;MsoNormal&quot;&gt;&lt;b&gt;HttpSession      &lt;/b&gt;contains various methods to      handle session object. &lt;b&gt;HttpSession object &lt;/b&gt;lives in the server&lt;b&gt;, &lt;/b&gt;and      it&lt;b&gt; &lt;/b&gt;automatically associated with the requester by internal      mechanism like &lt;b&gt;cookies &lt;/b&gt;or &lt;b&gt;URL-rewriting&lt;/b&gt;.&amp;nbsp; &lt;/li&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;mso-list: l0 level1 lfo1; tab-stops: list .5in;&quot;&gt;Whenever an application invokes or      removes an &lt;b&gt;object&lt;/b&gt; from a &lt;b&gt;session&lt;/b&gt;, the &lt;b&gt;session&lt;/b&gt; checks      whether the object implemented the &lt;b&gt;interface &lt;a href=&quot;http://docs.oracle.com/javaee/5/api/javax/servlet/http/HttpSessionBindingListener.html&quot; title=&quot;interface in javax.servlet.http&quot;&gt;HttpSessionBindingListener&lt;/a&gt;&lt;/b&gt;      or not. If yes, the &lt;b&gt;servlet&lt;/b&gt; informs the object that it has been &lt;b&gt;bounded      to the session&lt;/b&gt;, if not, notifies &lt;b&gt;unbound from the session&lt;/b&gt;. This      alert goes after the &lt;b&gt;binding methods&lt;/b&gt; complete.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;Example:&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .25in;&quot;&gt;
&lt;b&gt;HttpSession session = request.getSession(true);&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .25in;&quot;&gt;
/* &amp;nbsp;here, ‘request.getSession(true)’ - returns the current session associated with this request, or if the request does not have a session, creates one. */&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-right: -.5in;&quot;&gt;
&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ClientDetails client_details = (ClientDetails)session.&lt;/b&gt; &lt;b&gt;getAttribute(&quot;client_details&quot;);&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .25in;&quot;&gt;
&lt;b&gt;if(client_details != null) {&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .25in;&quot;&gt;
//that means, existing client, can do something with the client_details&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .25in;&quot;&gt;
&lt;b&gt;} else {&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .25in;&quot;&gt;
//create new client_details and store into the session&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .25in;&quot;&gt;
&lt;b&gt;}&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .25in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .25in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .25in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;



&lt;a href=&quot;https://plus.google.com/+AnijitSarkar?rel=author&quot; class=&quot;auth_style&quot;&gt;Anijit Sarkar&lt;/a&gt;
&lt;/div&gt;</description><link>http://interviewquestionjava.blogspot.com/2012/02/j2ee-servlet-session-tracking-in.html</link><author>noreply@blogger.com (Anijit Sarkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimCucHdAQldEu1iE7aU1BbWu_oiR_IkGnD_vkoQVjcuQk4Ob4yQR_f9V2NXJe_uFu4RzjyuVKKm0RItkUVU0izy7l-52l_FY-1EKfSvvmZkYz2n1fLRSVcctWBsjPvZz6QA_t1v9hDE60/s72-c/Apps-preferences-web-browser-cookies-icon.png" height="72" width="72"/><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3166332459178575831.post-33655407984661979</guid><pubDate>Fri, 10 Feb 2012 19:40:00 +0000</pubDate><atom:updated>2013-03-18T23:24:20.448+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">INTERNET</category><category domain="http://www.blogger.com/atom/ns#">INTERNET INTERVIEW QUESTIONS</category><title>INTERNET: HTTP vs. HTTPS</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9jmLohI1PuWbahxUcJxGmsfrFuz-XwrvHOt6PRlrKNGq0xSJalj4eaevpjng0YLw1NjV1gfqxmTVqd43-N6zalXdfuSyVRipV7hT4EWIQVk8ClMWs4emTRNZ-8EXJ6LwiZsJ2szi94_g/s1600/location-http-icon.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9jmLohI1PuWbahxUcJxGmsfrFuz-XwrvHOt6PRlrKNGq0xSJalj4eaevpjng0YLw1NjV1gfqxmTVqd43-N6zalXdfuSyVRipV7hT4EWIQVk8ClMWs4emTRNZ-8EXJ6LwiZsJ2szi94_g/s200/location-http-icon.png&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Symbol; font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;&lt;b&gt;HTTP&lt;/b&gt; stands for &lt;b&gt;HyperText Transfer Protocol&lt;/b&gt;, whereas, &lt;b&gt;HTTPS&lt;/b&gt; is &lt;b&gt;HyperText Transfer Protocol Secure&lt;/b&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Symbol; font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;&lt;b&gt;HTTP&lt;/b&gt; transmits everything as plan text, while &lt;b&gt;HTTPS&lt;/b&gt; provides encrypted communication, so that only the recipient can decrypt and read the information. &amp;nbsp;Basically, HTTPS is a combination of HTTP and &lt;b&gt;SSL&lt;/b&gt; (&lt;b&gt;Secure Sockets Layer&lt;/b&gt;). This SSL is that protocol which encrypts the data.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Symbol; font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;&lt;b&gt;HTTP&lt;/b&gt; is fast and cheap, where &lt;b&gt;HTTPS&lt;/b&gt; is slow and expensive.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Symbol; font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;As, &lt;b&gt;HTTPS&lt;/b&gt; is safe it’s widely used during payment transactions or any sensitive transactions over the internet. On the other hand, &lt;b&gt;HTTP&lt;/b&gt; is used most of the sites over the net, even this blogspot sites also use &lt;b&gt;HTTP&lt;/b&gt;.&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Symbol; font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;&lt;b&gt;HTTP URL&lt;/b&gt;s starts with “&lt;b&gt;http:// &lt;/b&gt;“ and use &lt;b&gt;port 80&lt;/b&gt; by default, while&lt;b&gt; HTTPS URL&lt;/b&gt;s stars with “&lt;b&gt;https://&lt;/b&gt; “ and use &lt;b&gt;port 443.&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Symbol; font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;&lt;b&gt;HTTP&lt;/b&gt; is unsafe from attacks like &lt;a href=&quot;http://en.wikipedia.org/wiki/Man-in-the-middle_attack&quot; target=&quot;_blank&quot;&gt;man-in-the-middle&lt;/a&gt; and eavesdropping, but &lt;b&gt;HTTPS&lt;/b&gt; is secure from these sorts of attacks.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</description><link>http://interviewquestionjava.blogspot.com/2012/02/internet-http-vs-https.html</link><author>noreply@blogger.com (Anijit Sarkar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9jmLohI1PuWbahxUcJxGmsfrFuz-XwrvHOt6PRlrKNGq0xSJalj4eaevpjng0YLw1NjV1gfqxmTVqd43-N6zalXdfuSyVRipV7hT4EWIQVk8ClMWs4emTRNZ-8EXJ6LwiZsJ2szi94_g/s72-c/location-http-icon.png" height="72" width="72"/><thr:total>18</thr:total></item></channel></rss>