I wanna know how to use WeakReference in developing android application.So as i searched a lot in the internet i typed this code :
{
String kk = "Test";
WeakReference<String> kkRef = new WeakReference<String>(kk);
System.out.println(kk);
System.out.println(kkRef.get());
kk = null;
System.gc();
System.out.println(kk);
System.out.println(kkRef.get());
}
which suppose to eligible the kk object to GC, But in the console output it seems that kkRef.get() still return the "Test" value which supposed to return null as i read about weakReference
So Why it didn't return null?