If you are using some other text editor (such as Notepad++) or an IDE (such as BlueJ) you can paste into it.
But for our minimal environment, continued with Notepad.
RIGHT-click in the Notepad window. A menu will appear. Select "Paste"
Or you can click in the window and hit control-V.
The program has been copied to Notepad.
How do you save the text in Notepad to a file?