public static TestObject testObject;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
Log.d(TAG,"onCreate()");
Context getApplicationContext = getApplicationContext();
testObject = new TestObject(getApplicationContext);
The object of testObject is stored in the heap area and the reference variable in the static area stores the reference value of the testObject object. So if the object reference value is stored in the static reference variable and the reference value of the new object is stored, can an object with the reference value stored in the static reference variable be subject to GC because it no longer receives reference from the static reference variable? If it could be subject to GC, why would a warning message be generated that there is a possibility of a memory leak when using static?