can write code for serialization ?
Answer / bharat shivram
import java.io.*;
public class SerializationDemo {
public static void main(String args[]) {
// Object serialization
try {
MyClass object1 = new MyClass("Hello", -7, 2.7e10);
System.out.println("object1: " + object1);
FileOutputStream fos = new FileOutputStream("serial");
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(object1);
oos.flush();
oos.close();
}
catch(Exception e) {
System.out.println("Exception during serialization: " + e);
System.exit(0);
}
Is This Answer Correct ? | 3 Yes | 0 No |
Is char a data type in java?
What is unicode?
How would you format a date in java? I.e. In the ddmmyyy format?
Explain scope or life time of local variables in java?
what is difference Between Core Java and advance java
60 Answers HCL, HP, Sambalpur University, TCS, Vensai Technologies, Wipro,
Is class is a data type?
How u dubugg ur project?
What are operators and its types?
What is the main functionality of Prepared Statement?
What is the difference between serializable and externalizable interface?
What is difference between next () and nextline () in java?
write a program to create an arraylist with string(add,remove) operation.and value should be enter through keyboard.