You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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 );
}
}