For example
class MyClass {
private MyField1 f1;
private MyField2 f2;
@override
protected void finalize() throws Throwable {
System.out.println("MyClass finalized.");
}
}
When an instance of MyClass
finalized, is f1
and f2
also finalized?
If MyField1
and MyField2
also have finalizer, what's the execution order among them?