Which method(s) must a serializable class, implement?
AIt must always implement both readObject and writeObject
BIt must implement either readObject or writeObject, or both, depending upon the desired behavior
CNo Need to implement any methods
DNone of the given option is correct
Serializable is a marker interface with no methods; implementing it is enough.
2.
★ Final term past paper
The "transient" keyword is used to _______ serialization.
Aprevent
Ballow
Cavoid
Dnone of the given options
A transient field is not saved when the object is serialized, so transient prevents its serialization.
No MCQs match this filter.Is filter mein koi MCQ nahi.
1.
★ Final term July 2012Lecture 223 marks
Diff b/w serialized and deserializaed
Show answerJawab dekhein
Serialization converts an object (its state) into a stream of bytes so it can be saved to a file or sent over a network, using ObjectOutputStream.writeObject(); the class must implement Serializable. Deserialization is the reverse: it reads the byte stream with ObjectInputStream.readObject() and rebuilds a copy of the original object in memory.
2.
★ Final term 2012Lecture 22
Which method is used to read an object through serialization?
Show answerJawab dekhein
The readObject() method of ObjectInputStream is used to read (deserialize) an object; the result is cast to the original class.
3.
★ Final term Spring 2011Lecture 222 marks
What is meant by keyword transient?
Show answerJawab dekhein
The transient keyword marks a field that must not be serialized. When the object is written with ObjectOutputStream the field is skipped, and after deserialization it gets its default value.
No long questions added yet.Abhi koi long sawal shamil nahi.