File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

"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][/url] | [url][/url]
Michael Ernest
High Plains Drifter

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:
subject: "Potential Problem" in following prg ?
It's not a secret anymore!