問題文
A class implements the marker interface for serialization, and one of its fields holds a cached password that must never be written to a file. What has to change?
選択肢
- That field has to be declared static, because the state of the class is written into a separate part of the stream that the reader is able to skip
- That field has to carry the modifier that excludes it from serialization, so the restored object receives the default value for the declared type of that field
- The whole class has to implement the interface for external serialization, because a field is excluded only when the class writes its own fields by hand
- That field has to be declared final, because a final field is left out of the stream and rebuilt from the constructor when the object is restored