I have two examples :
Example 1:
try (ByteArrayOutputStream baous = new ByteArrayOutputStream(); FileOutputStream fouscrx = new FileOutputSt
ZipOutputStream has to do several operations at the end of the stream to finish the zip file, so it's necessary for it to be closed properly. (Generally speaking, pretty much every stream should be closed properly, just as good practice.)
ZipOutputStream