tag:blogger.com,1999:blog-205030209684246887.post638218765584278198..comments2024-03-27T14:53:49.838+05:30Comments on Java tutorial and Java Interview Questions and Answers: Singleton Design Pattern in java with exampleAnil Nivargihttp://www.blogger.com/profile/06734257637895367389noreply@blogger.comBlogger9125tag:blogger.com,1999:blog-205030209684246887.post-33433622849695133702020-04-13T13:58:13.705+05:302020-04-13T13:58:13.705+05:30Well explained . Great article on singleton patter...Well explained . Great article on singleton pattern . There is also good singleton pattern example visit <a href="https://www.javavogue.com/2015/11/how-to-make-singleton-class-in-java.html/" rel="nofollow"> Singleton class example </a>subham kumarhttps://www.blogger.com/profile/01727881826778414825noreply@blogger.comtag:blogger.com,1999:blog-205030209684246887.post-5434671749427016012018-11-02T18:18:15.688+05:302018-11-02T18:18:15.688+05:30Really nice article and well explained. But this i...Really nice article and well explained. But this is for single threaded applications. So what about multiple thread application. I found a really great explanation and solution <a href="http://www.tellmehow.co/concept-singleton-class-java-detailed/#how-to-make-singleton-class" rel="nofollow">there</a>.<br />Tell Me Howhttps://www.blogger.com/profile/10113217197344509928noreply@blogger.comtag:blogger.com,1999:blog-205030209684246887.post-31386667514090960512018-07-05T16:24:00.373+05:302018-07-05T16:24:00.373+05:30Great Blog Anil,its really helps lot .Great Blog Anil,its really helps lot .Anonymoushttps://www.blogger.com/profile/13930526077482103914noreply@blogger.comtag:blogger.com,1999:blog-205030209684246887.post-6942807697724151782017-10-03T15:32:37.260+05:302017-10-03T15:32:37.260+05:30"Great blog created by you. I read your blog,..."Great blog created by you. I read your blog, its best and useful information. You have done a great work. Super blogging and keep it up.<a href="" rel="nofollow">php jobs in hyderabad</a>.<br />"<br />Anonymoushttps://www.blogger.com/profile/05991518150961162659noreply@blogger.comtag:blogger.com,1999:blog-205030209684246887.post-8891773102212977552017-08-12T17:08:51.173+05:302017-08-12T17:08:51.173+05:30Good explanation Anil !!Good explanation Anil !!Anonymoushttps://www.blogger.com/profile/07048379718602960043noreply@blogger.comtag:blogger.com,1999:blog-205030209684246887.post-50366290819901514772017-08-11T14:52:06.659+05:302017-08-11T14:52:06.659+05:30How to restrict the object creation in java using ...How to restrict the object creation in java using singleton please refer this <a href="http://www.benchresources.net/singleton-design-pattern-restricting-all-4-ways-of-object-creation-in-java/" rel="nofollow">click here</a>Anil Nivargihttps://www.blogger.com/profile/06734257637895367389noreply@blogger.comtag:blogger.com,1999:blog-205030209684246887.post-29263869073638329222017-07-08T22:46:31.844+05:302017-07-08T22:46:31.844+05:30Thanks sagar...I corrected it.Thanks sagar...I corrected it.Anil Nivargihttps://www.blogger.com/profile/06734257637895367389noreply@blogger.comtag:blogger.com,1999:blog-205030209684246887.post-58275673587517170792017-06-14T18:32:23.071+05:302017-06-14T18:32:23.071+05:30Nice Tutorial Anil, with real world example. it ea...Nice Tutorial Anil, with real world example. it easy to understand for newbie. Divyesh Kanzariyahttp://javatutorialspot.comnoreply@blogger.comtag:blogger.com,1999:blog-205030209684246887.post-85278847860452306462017-05-26T16:53:34.590+05:302017-05-26T16:53:34.590+05:30Hello Sir,
Thanks for such wonderful articles.
I...Hello Sir,<br /><br />Thanks for such wonderful articles.<br /><br />It helped me a lot.<br /><br />I have one doubt over here.<br /><br />public class LazyInitializer{<br /> private static final LazyInitializer instance = null;<br /> //private constructor to avoid client applications to use constructor.<br /> private LazyInitializer(){<br /> }<br /> public static LazyInitializer getInstance(){<br /> if(instance == null){<br /> instance = new LazyInitializer();<br /> }<br /> return instance;<br /> }<br /> }<br /><br />In above example<br />instance is declared as static final.<br /><br />And we can assign value to static final variable either at the line of declaration or in the static block.<br /><br />But here you are assigning value to static variable in getInstance() method.<br /><br />As per my knowledge it will give compile time error.<br /><br />Can you please clear my doubt?<br /><br />Thanks in Advance.<br /><br />Regards,<br />SagarAnonymoushttps://www.blogger.com/profile/07483979742037000505noreply@blogger.com