wood burning stoves 2.0*
The moose likes Java in General and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark ""Potential Problem" in following prg ?" Watch ""Potential Problem" in following prg ?" New topic
Author

"Potential Problem" in following prg ?

omkar patkar
Ranch Hand

Joined: Aug 25, 2005
Posts: 231
1.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;
}


this was an interview q asked to one of my freinds ........any one knows ?
[ September 17, 2005: Message edited by: Michael Ernest ]

Thanks and Regards
Omkar Patkar (SCJP 1.4)[url]http://javacollectionsnotes.blogspot.com[/url] | [url]http://omkar-myscjpexp.blogspot.com[/url]
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

If it's an interview question, then let's put it in Jobs Discussion.


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: "Potential Problem" in following prg ?
 
Similar Threads
"POTENTIAL PROBLEM" in following prg ?
Core Java
prb with follwing prg
Singleton Problem---- Real Problem
what is the use of this " static A a = new A() "