April 05
Prof. Ismael H. F. Santos -  ismael@tecgraf.puc-rio.br                                                          2
Exemplo 2 – Serialização
nGrafo.java
n
n// ...
nFuncionario g = new Funcionario ("Manoel Joaquim",
n "Gerente de Projeto", 31500, null);
nFuncionario f = new Funcionario ("João da Silva",
n "Programador Java", 17500, g);
nFileOutputStream s = new FileOutputStream ("tmp");
nObjectOutputStream oos = new ObjectOutputStream (s);
noos.writeObject (f);
n// ...
nFuncionario x = (Funcionario) ois.readObject();
nSystem.out.println (x.gerente.nome);