|
Serializing/Deserializing objects is very useful if you want to use a Java object in the future. The following code shows how to serialize an object.
Object object = new String("Hello World");
try {
// Serialize to a file
ObjectOutput out = new ObjectOutputStream(new FileOutputStream("filename.ser"));
out.writeObject(object);
out.close();
} catch (IOException e) {
e.printStackTrace();
}
|
|
Page 1 of 0 ( 0 comments )
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.