How many ways are there to let the code output itself?
For example, write the code below,
public class Test { public static void main(String[] args) { // some code } }
to output itself
public class Test { public static void main(String[] args) { // some code } }
(Any programming language is accepted)
EDIT This question has been answered in the historical posts, search ‘quine’ or check out https://stackoverflow.com/search?q=quine
This is called a programming quine, and has been extensively discussed on SO:
https://stackoverflow.com/search?q=quine
Also see
http://en.wikipedia.org/wiki/Quine_(computing)
http://www.nyx.net/~gthompso/quine.htm
http://www.madore.org/~david/computers/quine.html
-Adam