This week's book giveaways are in the iOS and Features new in Java 8 forums.
We're giving away four copies each of Barcodes with iOS: Bringing together the digital and physical worlds and Core Java for the Impatient and have the authors on-line!
See this thread and this one for details.
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


Win a copy of Barcodes with iOS this week in the iOS forum
or Core Java for the Impatient in the Java 8 forum!

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://kickstarter.com/rocket-mass-heater
 
subject: Core Java