944,154 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 2085
  • Java RSS
Feb 23rd, 2007
0

singleton

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mengani123 is offline Offline
2 posts
since Feb 2007
Feb 23rd, 2007
0

Re: singleton

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.
Reputation Points: 769
Solved Threads: 128
Banned
ithelp is offline Offline
1,910 posts
since May 2006
Feb 23rd, 2007
0

Re: singleton

Hi ithelp,
Your absolutely right. Also adding to it

Java Singleton pattern
Reputation Points: 10
Solved Threads: 0
Light Poster
hemanthjava is offline Offline
34 posts
since Jan 2006
Feb 23rd, 2007
0

Re: singleton

Click to Expand / Collapse  Quote originally posted by mengani123 ...
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...
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 874
Code tags enforcer
peter_budo is offline Offline
6,659 posts
since Dec 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: CubicCurve2D doubt
Next Thread in Java Forum Timeline: Inserting Audio clip





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC