<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='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'><id>tag:blogger.com,1999:blog-840345253657498798</id><updated>2024-08-31T16:23:05.348-07:00</updated><title type='text'>Java Answers</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://javaanswers-pranav.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/840345253657498798/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://javaanswers-pranav.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Pranav</name><uri>http://www.blogger.com/profile/04916046693370822165</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUGn68V9qIy2aBj2abqc7c_Rhuixw2_hy-YAc0ALCBTBjeTIhYXT-akt16RC_W1s050z43j7aNrul9WgCo08bIdYnpmzYgPIKTsn_5TCOuQ6RdzL5niBq49bEf8xnrzA/s220/IMG_1389.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>7</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-840345253657498798.post-328382819076849462</id><published>2011-01-08T17:31:00.000-08:00</published><updated>2011-01-08T17:31:41.591-08:00</updated><title type='text'></title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white; font-family: Arial, Helvetica, sans-serif;&quot;&gt;Q. What is&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 12px;&quot;&gt;the difference between a Buffered Writer and a Print Writer?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 12px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 12px;&quot;&gt;Ans.&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;These classes were implemented for different aims. For example, Print Writer is just a convenient class to write some text information. It is convenient because it has methods to write strings, any primitives (double, float, ...) and so on, you should not convert primitive to string, some useful methods have been already implemented.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;
Buffered Writer was implemented not for user convenience but for performance. The main aim of this class is to buffering characters that means if you call write(char[]) method it will flush characters to underlying outputstream only when some threshold will be reached.&lt;/span&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaanswers-pranav.blogspot.com/feeds/328382819076849462/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaanswers-pranav.blogspot.com/2011/01/q_1841.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/840345253657498798/posts/default/328382819076849462'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/840345253657498798/posts/default/328382819076849462'/><link rel='alternate' type='text/html' href='http://javaanswers-pranav.blogspot.com/2011/01/q_1841.html' title=''/><author><name>Pranav</name><uri>http://www.blogger.com/profile/04916046693370822165</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUGn68V9qIy2aBj2abqc7c_Rhuixw2_hy-YAc0ALCBTBjeTIhYXT-akt16RC_W1s050z43j7aNrul9WgCo08bIdYnpmzYgPIKTsn_5TCOuQ6RdzL5niBq49bEf8xnrzA/s220/IMG_1389.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-840345253657498798.post-5097787342705349110</id><published>2011-01-08T17:24:00.000-08:00</published><updated>2011-01-08T17:24:11.400-08:00</updated><title type='text'></title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;Q. W&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, &#39;Nimbus Sans L&#39;, sans-serif; line-height: 12px;&quot;&gt;hy interface variables are final?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, &#39;Nimbus Sans L&#39;, sans-serif; line-height: 12px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, &#39;Nimbus Sans L&#39;, sans-serif; line-height: 12px;&quot;&gt;Ans.&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, &#39;Nimbus Sans L&#39;, sans-serif; line-height: 15px;&quot;&gt;An Interface is a contract, so everything has to remain the same. If you declare a variable, it means that the variable is always available to the implementation. This is also true to the value. If someone was able to change the value, you can not depend on the value, thus breaking the contract.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, &#39;Nimbus Sans L&#39;, sans-serif; line-height: 15px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, &#39;Nimbus Sans L&#39;, sans-serif; line-height: 15px;&quot;&gt;Q.&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, &#39;Nimbus Sans L&#39;, sans-serif; line-height: 12px;&quot;&gt;Why there are two ways of implementing Thread in Java?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, &#39;Nimbus Sans L&#39;, sans-serif; line-height: 12px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, &#39;Nimbus Sans L&#39;, sans-serif; line-height: 12px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;Please answer this question.&lt;/span&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaanswers-pranav.blogspot.com/feeds/5097787342705349110/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaanswers-pranav.blogspot.com/2011/01/q_08.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/840345253657498798/posts/default/5097787342705349110'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/840345253657498798/posts/default/5097787342705349110'/><link rel='alternate' type='text/html' href='http://javaanswers-pranav.blogspot.com/2011/01/q_08.html' title=''/><author><name>Pranav</name><uri>http://www.blogger.com/profile/04916046693370822165</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUGn68V9qIy2aBj2abqc7c_Rhuixw2_hy-YAc0ALCBTBjeTIhYXT-akt16RC_W1s050z43j7aNrul9WgCo08bIdYnpmzYgPIKTsn_5TCOuQ6RdzL5niBq49bEf8xnrzA/s220/IMG_1389.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-840345253657498798.post-3362894393707677545</id><published>2011-01-08T15:44:00.000-08:00</published><updated>2011-01-08T15:44:22.769-08:00</updated><title type='text'></title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, &#39;Nimbus Sans L&#39;, sans-serif; font-size: 10px; line-height: 12px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3 class=&quot;groups&quot; style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white; font-size: small;&quot;&gt;Q. Explain which bean is faster than other(Stateless/Statefull) and why?&lt;/span&gt;&lt;/h3&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;Ans:&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, &#39;Nimbus Sans L&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;State full bean has to be persisted while stateless is only used once. If cluster is used,&amp;nbsp;State full&amp;nbsp;Session Bean has to be replicated on all servers.&amp;nbsp;State full&amp;nbsp;Session Bean&amp;nbsp;has to be tied to session and used for that session only, while State Less Session Bean is used for single request only.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, &#39;Nimbus Sans L&#39;, sans-serif; line-height: 15px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;But, State less and State full have different usages. If you are building request response application State less is OK. If you have app that has to remember state between multiple requests, State full is the option.&lt;/span&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaanswers-pranav.blogspot.com/feeds/3362894393707677545/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaanswers-pranav.blogspot.com/2011/01/q.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/840345253657498798/posts/default/3362894393707677545'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/840345253657498798/posts/default/3362894393707677545'/><link rel='alternate' type='text/html' href='http://javaanswers-pranav.blogspot.com/2011/01/q.html' title=''/><author><name>Pranav</name><uri>http://www.blogger.com/profile/04916046693370822165</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUGn68V9qIy2aBj2abqc7c_Rhuixw2_hy-YAc0ALCBTBjeTIhYXT-akt16RC_W1s050z43j7aNrul9WgCo08bIdYnpmzYgPIKTsn_5TCOuQ6RdzL5niBq49bEf8xnrzA/s220/IMG_1389.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-840345253657498798.post-5209712984475121119</id><published>2010-12-02T18:02:00.000-08:00</published><updated>2010-12-02T18:02:32.282-08:00</updated><title type='text'></title><content type='html'>&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;color: white; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-ansi-language: EN-IN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-IN; mso-themecolor: background1;&quot;&gt;Question :&lt;span style=&quot;mso-bidi-font-weight: bold;&quot;&gt;Please explain Hashtable vs ConcurrentHashMap.&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;margin-bottom: .0001pt; margin-bottom: 0cm; mso-line-height-alt: 9.0pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-line-height-alt: 9.0pt;&quot;&gt;&lt;span style=&quot;color: white; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-ansi-language: EN-IN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-IN; mso-themecolor: background1;&quot;&gt;Answer :&amp;nbsp;Hashtable and ConcurrentHashMap are both thread safe, but these classes have different implementations. ConcurrentHashMap is faster than Hashtable, the main difference is that Hashtable uses one lock for all map, but ConcurrentHashMap uses one lock per bucket therefore several threads can modify the map without blocking.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaanswers-pranav.blogspot.com/feeds/5209712984475121119/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaanswers-pranav.blogspot.com/2010/12/question-please-explain-hashtable-vs.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/840345253657498798/posts/default/5209712984475121119'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/840345253657498798/posts/default/5209712984475121119'/><link rel='alternate' type='text/html' href='http://javaanswers-pranav.blogspot.com/2010/12/question-please-explain-hashtable-vs.html' title=''/><author><name>Pranav</name><uri>http://www.blogger.com/profile/04916046693370822165</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUGn68V9qIy2aBj2abqc7c_Rhuixw2_hy-YAc0ALCBTBjeTIhYXT-akt16RC_W1s050z43j7aNrul9WgCo08bIdYnpmzYgPIKTsn_5TCOuQ6RdzL5niBq49bEf8xnrzA/s220/IMG_1389.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-840345253657498798.post-5008109548652023164</id><published>2010-11-29T17:15:00.000-08:00</published><updated>2010-11-29T17:15:01.697-08:00</updated><title type='text'></title><content type='html'>&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;Question:&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;What is the significance of synchronized method/block?&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;margin-bottom: .0001pt; margin-bottom: 0cm; mso-line-height-alt: 8.0pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-line-height-alt: 8.0pt;&quot;&gt;&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;Answer: &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;Synchronized works on objects, meaning that only one thread can obtain lock on a certain instance of an object. Only one thread can execute synchronized block of code on a certain object. Example of such object is list that is accessed synchronized, so that multiple threads are accessing list without corrupting its contents.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&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;margin-bottom: .0001pt; margin-bottom: 0cm; mso-line-height-alt: 8.0pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-line-height-alt: 8.0pt;&quot;&gt;&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;Question: Explain&amp;nbsp;JVM Memory Management.&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;margin-bottom: .0001pt; margin-bottom: 0cm; mso-line-height-alt: 8.0pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-line-height-alt: 8.0pt;&quot;&gt;&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;Answer:&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;Java manages memory in 3 different places:&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&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;&gt;&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;br /&gt;
Stack:&lt;br /&gt;
• Stacks holds method’s arguments, return value &amp;amp; local variable.&lt;br /&gt;
• FILO – First In Last Out basis. The life time of the stack members decide based on&lt;br /&gt;
scope.&lt;br /&gt;
• Initial stack size will be allocated by JVM if no arguments provide at start up.&lt;br /&gt;
•Stack using Push-Pop operation to manage its contents.&lt;br /&gt;
&lt;br /&gt;
Static memory Area:&lt;br /&gt;
• This area holds all the static members of the class and also maintains run time constant pool. Run time constant pool is the table maintained by the JVM which holds string literals, constants etc.&lt;br /&gt;
• All the instances will share this location if multiple instances created for the class.&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white;&quot;&gt;&lt;br /&gt;
Heap :&lt;br /&gt;
• This place holds all the real live instances &amp;amp; Arrays – whatever we create using new key word will get physical memory in this place.&lt;br /&gt;
•JVM use Garbage Collector to manage this memory location.&lt;br /&gt;
•Initial Heap size will be allocated by JVM if no arguments provide at start up.&lt;br /&gt;
&lt;br /&gt;
Please note that all the above 3 types of memory resides in RAM.&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaanswers-pranav.blogspot.com/feeds/5008109548652023164/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaanswers-pranav.blogspot.com/2010/11/question-what-is-significance-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/840345253657498798/posts/default/5008109548652023164'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/840345253657498798/posts/default/5008109548652023164'/><link rel='alternate' type='text/html' href='http://javaanswers-pranav.blogspot.com/2010/11/question-what-is-significance-of.html' title=''/><author><name>Pranav</name><uri>http://www.blogger.com/profile/04916046693370822165</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUGn68V9qIy2aBj2abqc7c_Rhuixw2_hy-YAc0ALCBTBjeTIhYXT-akt16RC_W1s050z43j7aNrul9WgCo08bIdYnpmzYgPIKTsn_5TCOuQ6RdzL5niBq49bEf8xnrzA/s220/IMG_1389.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-840345253657498798.post-8346487514176544490</id><published>2010-11-28T16:58:00.000-08:00</published><updated>2010-11-28T17:07:55.341-08:00</updated><title type='text'></title><content type='html'>&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white; font-family: Arial, sans-serif;&quot;&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white; font-family: Arial, sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-ansi-language: EN-IN; mso-bidi-font-weight: bold; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-IN;&quot;&gt;Question 1:&amp;nbsp;How static polymorphism and dynamic polymorphism is achieved?&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; mso-ansi-language: EN-IN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white; font-family: Arial, sans-serif;&quot;&gt;&lt;b&gt;  &lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-ansi-language: EN-IN; mso-bidi-font-weight: bold; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-IN;&quot;&gt;Answer:&amp;nbsp;Static polymorphism is a compile time polymorphism and can be achieved through overloading of methods. At the time of compilation, it is known which method will execute in response to a method call.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; mso-ansi-language: EN-IN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-ansi-language: EN-IN; mso-bidi-font-weight: bold; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-IN;&quot;&gt;Dynamic polymorphism is also called run-time polymorphism. The method execution is known at run time depending upon the object being referred to . It can be achieved by overriding methods in class and in Interface implementation. As this is done dynamically so it is called dynamic polymorphism.&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; mso-ansi-language: EN-IN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-outline-level: 3; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-ansi-language: EN-IN; mso-bidi-font-weight: bold; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-IN;&quot;&gt;Question 2: Explain purpose and exact use of finally vs finalize().&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-outline-level: 3; vertical-align: baseline;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-outline-level: 3; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-ansi-language: EN-IN; mso-bidi-font-weight: bold; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-IN;&quot;&gt;Answer:&lt;br /&gt;
Finally:-&lt;br /&gt;
1) The finally block always executes when the try block exits, except System.exit(0) call.&lt;br /&gt;
&lt;br /&gt;
2) Ensures that the finally block is executed even if an unexpected exception occurs.&lt;br /&gt;
&lt;br /&gt;
3) Finally is useful for more than just exception handling — it allows the programmer to avoid having cleanup code accidentally bypassed by a return, continue, or break. Putting cleanup code in a finally block is always a good practice, even when no exceptions are anticipated.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-outline-level: 3; vertical-align: baseline;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-bidi-font-weight: bold; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-IN;&quot;&gt;Finalize:-&lt;br /&gt;
1) This is used to clean up memory resources for object using finalize().&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) This is used just before an object is destroyed and can be called just prior to garbage collection.&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; mso-ansi-language: EN-IN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-IN;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaanswers-pranav.blogspot.com/feeds/8346487514176544490/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaanswers-pranav.blogspot.com/2010/11/question-1-how-static-polymorphism-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/840345253657498798/posts/default/8346487514176544490'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/840345253657498798/posts/default/8346487514176544490'/><link rel='alternate' type='text/html' href='http://javaanswers-pranav.blogspot.com/2010/11/question-1-how-static-polymorphism-and.html' title=''/><author><name>Pranav</name><uri>http://www.blogger.com/profile/04916046693370822165</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUGn68V9qIy2aBj2abqc7c_Rhuixw2_hy-YAc0ALCBTBjeTIhYXT-akt16RC_W1s050z43j7aNrul9WgCo08bIdYnpmzYgPIKTsn_5TCOuQ6RdzL5niBq49bEf8xnrzA/s220/IMG_1389.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-840345253657498798.post-8151270599879409702</id><published>2010-11-28T16:50:00.000-08:00</published><updated>2011-01-08T15:55:58.949-08:00</updated><title type='text'></title><content type='html'>Hi Friends,&lt;br /&gt;
Here I am going to put some common questions and their answers related to Java, J2EE and others.&lt;br /&gt;
Some of questions might look silly, but freshers might need their answers and I will try to improve this periodically. Some questions and their answers picked from discussion boards and I am just consolidating those questions and responses.&lt;br /&gt;
&lt;br /&gt;
Your comments are valuable for me.</content><link rel='replies' type='application/atom+xml' href='http://javaanswers-pranav.blogspot.com/feeds/8151270599879409702/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaanswers-pranav.blogspot.com/2010/11/hi-friends-here-i-am-going-to-put-some.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/840345253657498798/posts/default/8151270599879409702'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/840345253657498798/posts/default/8151270599879409702'/><link rel='alternate' type='text/html' href='http://javaanswers-pranav.blogspot.com/2010/11/hi-friends-here-i-am-going-to-put-some.html' title=''/><author><name>Pranav</name><uri>http://www.blogger.com/profile/04916046693370822165</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUGn68V9qIy2aBj2abqc7c_Rhuixw2_hy-YAc0ALCBTBjeTIhYXT-akt16RC_W1s050z43j7aNrul9WgCo08bIdYnpmzYgPIKTsn_5TCOuQ6RdzL5niBq49bEf8xnrzA/s220/IMG_1389.JPG'/></author><thr:total>0</thr:total></entry></feed>