In my interview i got one question how to achive Serialization and I gave answer as
public class SerializationSample {
    public static void main(String args[]) {
        ...........
        FileOutputStream fos = new FileOutputStream(outFile);
        ObjectOutputStream oos = new ObjectOutputStream(fos);
        oos.writeObject(serializableObject);
        ............
}
class SerializationBox implements Serializable {
    ............
    ............
}
but the interviewer told, this will serialize whole object and he asked 2 questions
- How you will write a code if i want to serialize single object?
- Why we use long_integer id during serialization?
Please any one can help me to finding answer for this question
 
     
    