forked from codehouseindia/Java-Programs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDemo.java
More file actions
36 lines (35 loc) · 828 Bytes
/
Copy pathDemo.java
File metadata and controls
36 lines (35 loc) · 828 Bytes
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
32
33
34
35
36
package demo;
import java.io.*;
class Customer implements Serializable
{
String name,email;
int marks;
public Customer(String name,String email,int marks)
{
this.name=name;
this.email=email;
this.marks=marks;
}
}
public class Demo
{
public static void main(String[] argv)throws Exception
{
try
{
Customer c=new Customer("gopal","jaingopal09@gmail.com",475);
FileOutputStream fos=new FileOutputStream("abc.txt");
ObjectOutputStream oos=new ObjectOutputStream(fos);
oos.writeObject(c);
}
catch(Exception e)
{
e.printStackTrace();
}
/* try
{
FileOutputStream fos=new FileOutputStream("C:\Users\hp\Documents\java(wipro)");
ObjectOutputStream oos=new ObjectOutputStream(fos);
}*/
}
}