Serializable is used to read or write the object and find the state of an object. What is the use of finding the state of an object, Explain with an example?
RE: Serializable is used to read or write the object and find the state of an object. What is the use of finding the state of an object, Explain with an example?
If we have to use an object on remote mechine then we ned that data for this we neede serilizaion technique
RE: Serializable is used to read or write the object and find the state of an object. What is the use of finding the state of an object, Explain with an example?
Serializable is the concept of Storing the state of an Object. Consider a scenario you want to send an object via network. In the middle if the network fails or some error happens your object state will be lost. for ex: String is an serializable object. if you want to send a data via network we usually send in String because the object state may not be lost as String is serializable object.
RE: Serializable is used to read or write the object and find the state of an object. What is the use of finding the state of an object, Explain with an example?
When the object supposed to be sent across the network serializing technique makes sure the data is not lost in case of network failure. Seralizaing is converting the object to its byte code form and then sending it accross the network.
RE: Serializable is used to read or write the object and find the state of an object. What is the use of finding the state of an object, Explain with an example?
The concept of Serializable is that we can recreate the state of an object from a permanent source like a file xml etc.
Example: I had personally implemented used in scenario where i had an organization which had their main offices in California with branch offices in various other states. The branch offices used to have a front end where the orders received were saved for their details like Order Id Party Name Order Amount etc. Then at the end of the day all these files were ftp'ed to the Head Office and it was read back from the file.
The state of the order was serialized or persisted and then recreated and used again in the head office. We could ofcourse have used the normal File Streams for that but then we could not consider it as an object and move on with it.