-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathViDuGhiDoiTuong.java
More file actions
39 lines (33 loc) · 1.1 KB
/
Copy pathViDuGhiDoiTuong.java
File metadata and controls
39 lines (33 loc) · 1.1 KB
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
37
38
39
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
import sun.applet.Main;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author thien
*/
public class ViDuGhiDoiTuong {
public static void main(String[] args) throws IOException {
try {
File file = new File("C:\\Java\\JavaWriterOBJ\\file.data");
OutputStream os = new FileOutputStream(file);
ObjectOutputStream oos = new ObjectOutputStream(os);
SinhVien sv = new SinhVien("001","TITV", 2002, 10);
oos.writeObject(sv);
oos.flush();
oos.close();
} catch (FileNotFoundException ex) {
Logger.getLogger(ViDuGhiDoiTuong.class.getName()).log(Level.SEVERE, null, ex);
}
}
}