import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;
class DeserializationDemo {
public static void main(String[] args)
throws IOException, FileNotFoundException, ClassNotFoundException {
//creating stream to read the object
ObjectInputStream ois = new ObjectInputStream(
new FileInputStream("student.txt")
);
Student s = (Student) ois.readObject();
//printing the data of serialized object
System.out.println(s.id + " " + s.name);
//closing the stream
ois.close();
}
}