Understanding soft references in Java

Report a typo
Hey there! This problem might be a bit unpredictable, but give it a go and let us know how you do!
Consider the following code snippet in Java.
String str = new String("Hello");
SoftReference softStr = new SoftReference(str);
str = null;
System.gc();
str = softStr.get();
What type of references is used, and when is the garbage collector likely to reclaim the memory allocated for the str object?
Select one option from the list
___

Create a free account to access the full topic