IT Certificaions

Google Cloud Platform

Sunday, January 30, 2011

Singleton class:::Nucleous Software Java Interview Questions: Qu7

What is Singleton Class: How will you make a class singloton....

Singleton class:
This is a class which can be instatiated only once.


Public class Singleton
private static single = new Singleton();

Private Singleton();

For a singleton class, the constructor is made private and
a static variable is used for instatiating the class.