It would be a waste of memory to hold information about all java classes during a program, so I guess that classes are loaded into memory
when an instance of that class is first created or when a static member is accessed .When there are no objects of that class left
and if there are no references to static data of that class, I guess the class information will be removed from memory (garbage collection)
A potential problem with singletons is that if no object holds a a reference to the Singleton object then then the object and class
will be garbage collected. The next call to getSingleton() will cause the class to reload and a new instance of the Singleton will have to be created
, any data previously associated with it will have been lost. Hence within a program all calls to getSingleton() may not return exactly the same object.
However I shouldn't worry too much about it.
I don't think the Singleton pattern nor Class garbage collection are on the exam (Objective 5.1/5.2 and 7.4)