Strong Reference vs Soft Reference

Report a typo

Suppose you have the following code:

public class ReferenceTypesDemo {
    public static void main(String[] args) {
        Integer num = 1995;
        SoftReference<Integer> softReference = new SoftReference<>(num);
    }
}

Will the GC delete the num variable object if the application is close to running out of memory?

Select one option from the list
___

Create a free account to access the full topic