The following code:
public class TestInnerClass {
public static void main(String[] args) throws IOException {
new TestInnerClass().serializeInne
what if InnerClass needs this access?
Then it needs the outer class instance, and it must be serialized along with the inner class.
Is there a way to serialize a non-static inner class without the enclosing class, e.g. by making the reference to the outer class transient?
No. What would happen when you deserialize such a class and then try to call an instance method of the outer class? A NullPointerException
?