SCJP題庫第152題
Which three statements concerning the use of the java.io.Serializable interface are true? (Choose three.)
A. Objects from classes that use aggregation cannot be serialized.
B. An object serialized on one JVM can be successfully deserialized on a different JVM.
C. The values in fields with the volatile modifier will NOT survive serialization and deserialization.
D. The values in fields with the transient modifier will NOT survive serialization and deserialization.
E. It is legal to serialize an object of a type that has a supertype that does NOT implement java.io.Serializable.
Ans: BDE
解說:
那3個敘述關於使用java.io.Serializable介面是正確的?
B 一個物件在一個JVM序列化可以成功地在另一個JVM被反序列化。
D 使用transient關鍵字修飾的資料成員之資料將不會在序列化或反序列化被處理。 (transient表暫時性的)
E 一個物件,其父類別未實作java.io.Serializable的類別,對這樣的物件進行序列化是合法的。
Comments