Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
31 lines (28 loc) · 1.01 KB

File metadata and controls

31 lines (28 loc) · 1.01 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import java.io.*;
class SerelizaitionDemo implements Serializable
{
int i = 10;
int j = 20;
}
class Example1
{
/**
* Serelization
* The process of saving (or) writing state of an object to a file is called
* serialization
*/
public static void main(String[] args)throws Exception {
SerelizaitionDemo obj1=new SerelizaitionDemo();
System.out.println("Serelization started");
FileOutputStream fos=new FileOutputStream("abc.ser");
ObjectOutputStream oos=new ObjectOutputStream(fos);
oos.writeObject(obj1);
System.out.println("Serialization ended");
System.out.println("Deserialization started");
FileInputStream fis = new FileInputStream("abc.ser");
ObjectInputStream ois = new ObjectInputStream(fis);
SerelizaitionDemo d2 = (SerelizaitionDemo) ois.readObject();
System.out.println("Deserialization ended");
System.out.println(d2.i + "................" + d2.j);
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.