abalfazl hossein wrote:The code works and print members of array. Do you have suggestion to improve it?
Quite a few. I'd use a "new-style" for loop for the printing, for example:
You don't need to close both the ObjectInputStream and the FileInputStream. In general, workign with
Java streams, you only need to close the "outermost one" -- the one that wraps around the others. The others get closed automatically.
If there's a problem, your file doesn't get closed; always close files in a "finally" block.