Sunday 24 March 2019

Example of Java Deserialization .


Code:
?
1
2
3
4
5
6
7

import java.io.*; class Depersist{ public static void main(String args[])throws Exception{ ObjectInputStream in=new ObjectInputStream(new FileInputStream("f.txt")); Student s=(Student)in.readObject(); System.out.println(s.id+" "+s.name); in.close(); } }
Output:: 211 govind

No comments:

Post a Comment