Morgan Stanley Interview Question
391 Interview Reviews |
Back to all Morgan Stanley Interview Questions & Reviews
Interview questions and reviews posted anonymously by interview candidates
Interview Question for Software Engineer at Morgan Stanley:
How do you implement a singleton in Java? Make it thread-safe.
See more for this Morgan Stanley Software Engineer Interview
Helpful Question?
Yes |
No
Inappropriate?
Answers & Comments (2)
private static Foo instance;
private Foo() {}
public static syncrhonized Foo getInstance() {
if (instance == null) {
instance = new Foo();
}
return instance;
}
}
Helpful Answer?
Yes |
No
Inappropriate?
To comment on this
question,
Sign In with Facebook or
Sign Up
by ✳✳✳✳✳✳✳✳