Loading...
Engaged Employer
How would we make Singleton thread protected except interviewer did not want to include Synchronized block in there.
Anonymous
By making the costructor static
public class ThreadSafeSingleton { private static final Object instance = new Object(); protected ThreadSafeSingleton() { } // Runtime initialization // By defualt ThreadSafe public static Object getInstance() { return instance; } }
Hi, It will be great for us if you write more Technical and coding questions. Thank you
Check out your Company Bowl for anonymous work chats.
Get actionable career advice tailored to you by joining more bowls.
Stay ahead in opportunities and insider tips by following your dream companies.
Get personalized job recommendations and updates by starting your searches.