Refresh Your Java - Before Java Interview
We are Agile, believe in less Documentation - Only Quick notes (Java Interview Questions) of Java/J2ee Read more....
Serialization is the process of converting a set of
object instances that contain references to each other into a
linear stream of bytes,
which can then be sent through a
socket, stored to a
file, or simply manipulated as a stream of data.
Serialization is the mechanism used by
Objects would be
passed between JVMs, either as arguments in a method invocation
from a client to a server or as return values from a method
invocation.
The object which is to be serialzed should implement "Serializable" interface.
class
PersonDetails implements Serializable
We use ObjectOutputStream to Serialize the
Objects, please take a look at colored code snippet
below.
FileOutputStream fos =
null;
ObjectOutputStream out = null;
try {
fos = new
FileOutputStream(filename);
out =
new ObjectOutputStream(fos);
out.writeObject(list);
out.close();
System.out.println("Object Persisted");
} catch (IOException ex) {
ex.printStackTrace();
}
This Portal is intended to put all Java/J2ee related topics at one single place for quick referance, not only Technical , but also the Project Management Related thing such as Development Process methodoogies build process, unit testing etc.,
This Portal has More than 500 Java Interview Questions (also could be Considered as Quick Notes) very neatly separated topic by topic with simple diagrams which makes you easily understandable. Importantly these are from our Realtime expericance.