singleton means there is only one instance of sigleton class in lifetime of your JVM. synchronized your class does not prevent it having multiple instance in your JVM. singleton pattern gurantee you can only get resource from same source. I wish it would help.
If I am rich, I will spend more.<p>IBM 486 (OOAD & UML) & 141 (XML) passed<br />Oracle 1Z0-007 passed<br />MCSD MCDBA MCSE <br />SCJP SCSSA<br />CCNA CNA A+
Hi, Singleton is used when we want to create only one instance of an object. Such as in case of SessionManager where there should be only one instance which stores various session objects. Synchornized keyword is used when there are simultaneously many requests are there to an object and instead of have deadlock or something the request should be handled one at a time. In a synchronization when the first request is called lock is made on the object and other request have to wait till the process gets finished. So in singleton classes all the public methods are synchronized so that one request at a time is handled. Please correct me if i m wrong. Puja
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop