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

Get Java Programming for Beginners now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.