package inputOutput;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
public class IOManager {
public static void main(String[] args) {
ObjectInputStream in;
ObjectOutputStream out;
String name[] = { new String("현재은"), new String("이재영"),
new String("박지영") };
String newName[] = null;
try {
out = new ObjectOutputStream(new FileOutputStream("hello.txt"));
out.writeObject(name);
out.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
try {
in = new ObjectInputStream(new FileInputStream("hello.txt"));
try {
newName = (String[]) in.readObject();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
for (String s : newName) {
System.out.println(s);
}
}
}
흐흐.. 인규형 사랑해요♡