O'Reilly logo

Java Programming for Beginners by Mark Lassoff

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Deserializing an object

Let's begin by heading to our other class, that is, the DeSerialize class, and attempt to write a method that will pull the Car object out from that file that we've written its serialized information to. The steps for doing this are as follows:

  1. Once again, we're going to need a Car object, but this time, we're not going to initialize it with a constructor value; rather, we're going to set its value to be the object we read back from our file. The syntax we're going to use in our deserializer is going to look very similar to the syntax that we used in our Serialize class main method. Let's just copy the code of the Serialize class so that we can see mirrored similarities as we build our main method of DeSerialize

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required