write a sample code to create singleton class using java. ensure that only one instance will be creted and same will be returned always.


please do it.

sanjay

Make its constructor private and have a static method called instance(), inside this method create a instance only once , and return the same instance everytime this static method is called.

write a sample code to create singleton class using java. ensure that only one instance will be creted and same will be returned always.


please do it.

sanjay

Sanjay please do it on your own and return back when you get problem with code, not problem with personal lazines of actualy learning something.

Important thing is to read forums rules befor signing up for the forum. This forum doesn't provide solution to courseworks/assignments/project works. We help individuals which want to learn. Copy & paste somebody's work and put your signature bellow it is not our way of helping. If you want somebody else to do your work find other forum, but you will be charged for it...