I know that close() method inside streams is to release all the resources that were used for a operation.
Question is what exactly are the side effect if we don't close it? Following code does something like this
Please don't think silly of me by seeing "ObjectOutputStream stream" as static, I took it just to keep this Stream object alive for next write Operation. If you notice, First method call writeData() used text.txt file to write a object and did not close the stream. Later second method opened another stream to write to same file and so does the read operation. As far resources are concerned, should not we get IOException or something in this case.
Please do let me know If my assumption is wrong.