Explain the ways to serialize the java object

Explain the ways to serialize the java object.

- To serialize an object means to convert its state to a byte stream so that the byte stream can be reverted into a copy of the object.

- A Java object is serializable if its class or any of its superclasses implements either the java.io.Serializable interface or its subinterface, java.io.Externalizable.

- For example, the java.awt.Button class implements the Serializable interface, so it can serialize a java.awt.Button object and store that serialized state in a file.

- Later, you can read back the serialized state and deserialize into a java.awt.Button object.

Object serialization could be used in different ways:

1. Simple persistence of the object
2. Reading from and writing to files
3. RMI technology for communicating across hosts.

- The encryption and decryption is left to the network transport. SSL or the like can be used when a secured channel is needed.
Similarities between an array and an ArrayList - Java
The following are the similarities between an array and an ArrayList: - Both array and ArrayList can have duplicate elements in them...
Can we decide a session bean as stateless or stateful without seeing jar file?
A bean can be determined whether is a stateless or stateful by analyzing the deployment descriptor ejb-jar.xml...
What is non static block in java?
The non-static block code is executed when a new class is instantiated. It executes before the constructor’s execution...
Post your comment