Yep, I've written them many times myself. The easiest form of this type of program is a method that processes a String variable and outputs it, with the String containing all lines of the program apart from the String itself (obviously). You read the String line by line, reconstructing the program on System.out. At some point you will have to reconstruct the line containing the String itself, then continue with the rest of the program.
I'd recommend trying to write one yourself before copying one from the Internet, as it's a fascinating problem.
If you feel the need to cheat
, follow this link