programming-examples/java/XML/Deserialise object from file.java
2019-11-15 12:59:38 +01:00

19 lines
524 B
Java

Deserialise object from file
package com.ack.j2se.io;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
public class DeserialiseObjectFromFile {
public static void main( String[] args )
throws IOException, ClassNotFoundException {
FileInputStream fin = new FileInputStream( "thefile.obj" );
ObjectInputStream ois = new ObjectInputStream( fin );
String str = (String) ois.readObject();
ois.close();
System.out.println( str );
}
}