View Tanya  Sharma 's Profile
What is singleton?
It is one of the design pattern. This falls in the creational pattern of the design pattern. There will be only one instance for that entire JVM. You can achieve this by having the private constructor in the class. For eg., public class Singleton { private static final Singleton s = new Singleton(); private Singleton() { } public static Singleton getInstance() { return s; } // all non static methods … }
Asked by Tanya Sharma | Jul 17 2017 | Report this Report abuse
Replies (3)
View Shuchita   Shukla 's Profile
Below link could help for detailed description with examples

http://www.benchresources.net/singleton-design-pattern-with-java-serialization/

http://www.benchresources.net/singleton-design-pattern-restricting-all-4-ways-of-object-creation-in-java/
Jul 21 2017 | Report this Report abuse
View Khushi   Kumari 's Profile
Below link could help for detailed description with examples

http://www.benchresources.net/singleton-design-pattern-with-java-serialization/

http://www.benchresources.net/singleton-design-pattern-restricting-all-4-ways-of-object-creation-in-java/
Jul 21 2017 | Report this Report abuse
View Shatish  Rao 's Profile
It loads the class into the ClassLoader. It returns the Class. Using that you can get the instance ( “class-instance”.newInstance() ).
Jul 20 2017 | Report this Report abuse