Create and read a ROOT file

___Hello everybody.
Is it possible to create a ROOT file in a program and read it in the same program?
I mean I create a ROOT file and fill it in the first part of program , can I read it in the second part of the same program?
Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

Obviously, see for example

Thank you for your Guidance.