package com.sync;
import java.io.Serializable;
public class Student implements Serializable {
int id;
String name;
public Student(int idVal, String nameVal) {
this.id = idVal;
this.name = nameVal;
}
}
package com.sync;
import java.io.*;
class Persist {
public static void main(String args[]) throws Exception {
Student s1 = new Student(211, "renu");
FileOutputStream fout = new FileOutputStream("f.txt");
ObjectOutputStream out = new ObjectOutputStream(fout);
out.writeObject(s1);
out.flush();
System.out.println("success");
}
}
import java.io.Serializable;
public class Student implements Serializable {
int id;
String name;
public Student(int idVal, String nameVal) {
this.id = idVal;
this.name = nameVal;
}
}
package com.sync;
import java.io.*;
class Persist {
public static void main(String args[]) throws Exception {
Student s1 = new Student(211, "renu");
FileOutputStream fout = new FileOutputStream("f.txt");
ObjectOutputStream out = new ObjectOutputStream(fout);
out.writeObject(s1);
out.flush();
System.out.println("success");
}
}