Would highly recommend going through the above article, but the one which actually struck me was that within a given Java VM different classloaders can actually instantiate singletons more than once. E.g. two applications running within a WebSphere Application Server on a Single Java Virtual Machine would instantiate the Singleton (if being used in both the applications) twice as both the applications use their own classloaders wherein the classes loaded by one classloader does not have visibility on the classes loaded by the other classloader.
Thanks for giving this interview question.
ReplyDeleteJobs In India