WeakReference string didn't garbage collected? How?

后端 未结 3 1465
故里飘歌
故里飘歌 2020-12-18 09:12

I\'m reading about WeakReference in wikipedia and I saw this code

public class ReferenceTest {
        public static void main(String[] args) th         


        
3条回答
  •  一向
    一向 (楼主)
    2020-12-18 09:25

    Static variables are Garbage Collected only when the class is unloaded. Therefore you can see that the value of the static variable is still printed even after you manually triggered garbage collection.

提交回复
热议问题