wood burning stoves 2.0*
The moose likes Java in General and the fly likes Core Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

Core Java

SharajIndia Anand
Greenhorn

Joined: Sep 19, 2005
Posts: 2
Identify the problem within this snippet of Java/C# code. (This is not a trick question � there is a potential real problem in using this code)

class Singleton
{
public static Singleton Instance() {
if (_instance == null)
_instance = new Singleton();
return _instance;
}
protected Singleton() {}
private static Singleton _instance = null;
}
shank ram
Greenhorn

Joined: Sep 05, 2005
Posts: 22
i think we have had this before ...this is bound to be moved shortly ... check the appropriate forum to post properly.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Is this an "excercise for the student" or do you need links to how to fix this potential multithreading problem?


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

This is duplicate thread. Please ignore it, I'll ask for it to be closed.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Core Java