Latest News

 










Writing on an Object Stream

Previous slide Next slide Back to first slide View graphic version


Writing on an Object Stream


 
My other sites

Latest News

 










Writing on an Object Stream

    import java.io.*;


    public class SerializeTest {

    SerializeTest() {

    String st = new String("This is the message!");

    try {

    FileOutputStream f = new FileOutputStream("c:\\test.ser");

    ObjectOutputStream s = new ObjectOutputStream(f);

    s.writeObject(st);

    s.close();

    }

    catch (IOException e) { System.out.println(e.getMessage()); }

    }

    public static void main(String args[]) { new SerializeTest(); }

    }

Previous slide Next slide Back to first slide View graphic version