Weak reference: Difference between revisions

Content deleted Content added
m Replace "follow" by "form" which makes more sense looking at the beginning of the sentence
Java: The parameter passed to weak and strong constructor should be consistent.
Line 35:
public static void main(String[] args) throws InterruptedException {
 
WeakReference r = new WeakReference(new String("I'm here"));
StrongReference sr = new StrongReference("I'm here");
System.out.println("before gc: r=" + r.get() + ", static=" + sr.get());