Friday, April 22, 2016

java : serializable interface #interview

1. When should i implement serializable interface?
It lets you take an object or group of objects, put them on a disk or send them through a wire or wireless transport mechanism, then later, perhaps on another computer, reverse the process: resurrect the original object(s). The basic mechanisms are to flatten object(s) into a one-dimensional stream of bits, and to turn that stream of bits back into the original object(s).

Like the Transporter on Star Trek, it's all about taking something complicated and turning it into a flat sequence of 1s and 0s, then taking that sequence of 1s and 0s (possibly at another place, possibly at another time) and reconstructing the original complicated "something."
So, implement the Serializable interface when you need to store a copy of the object, send them it to another process on the same system or over the network.

2. Why do we do that?
Because you want to store or send an object.

3. Does it give any advantages or security?
It makes storing and sending objects easy. It has nothing to do with security.

No comments:

Post a Comment

Creating mirror of BST