Skip to content

Instantly share code, notes, and snippets.

@conikeec
Created June 14, 2018 14:00
Show Gist options
  • Save conikeec/aafae1354121ca5bc5f10a6a43ef5c57 to your computer and use it in GitHub Desktop.
Save conikeec/aafae1354121ca5bc5f10a6a43ef5c57 to your computer and use it in GitHub Desktop.
String name;
String filename = "file.bin";
try
{
FileInputStream file = new FileInputStream(filename);
ObjectInputStream out = new ObjectInputStream(file);
// Serialization of the "name" (String) object
// Will be written to "file.bin"
name = (String)out.readObject();
System.out.println(name);
out.close();
file.close();
}
catch(Exception e)
{
System.out.println("Exception: " + e.toString());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment