This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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
 
jQuery in Action, 2nd edition
 
subject: "Potential Problem" in following prg ?
 
Similar Threads
"POTENTIAL PROBLEM" in following prg ?
Singleton Problem---- Real Problem
prb with follwing prg
Core Java
what is the use of this " static A a = new A() "