java - Class object vs instance garbage collection when unreachable? -


when create new object employee emp = new employee, per mine understanding system class loader(in case of stand alone program) or web class loader(in case of webserver tomcat) loads employee class object(including class level fields/methods) , actual employee instance created.

my question why class object garbage collected if reference dead object garbage collected if unreachable.

is because employee class object still referred internally class loader(system/web class loader) employee instance not referred class loader ?

update :- question has been marked duplicate of when , how classes garbage collected in java? not answer mine question. question comparison why class not gc'ed object not should reopened . link answered when/when not class object can garbage collected question why not object also. not reference class loader ?


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -