That is happening because, when you are renaming your file to a different file object, then a new file is created, content of old file / directory is copied there, and the old file/directory is deleted.
So, after the rename operation, your directory referenced by `file` object doesn't exist.
And delete myDir and newDirName ( physical directories and files) and run this program twice and note the difference. That will answer your first and second question.
As for the last question, I think the original file/dir references are not deleted after we rename a file/directory. In any case a File object is just a file ( directory or file ) name that exists even after a rename. The old reference has a name ( file/directory name) but the actual physical dir/file as such does not exist cause it has been renamed. It is the new reference that is now mapped with the physical file/direcory after the rename. So a file or directory reference variable would still have the same name although the actual file/directory may not exist.