0

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

3
  • Turning this into a community wiki would surely attract more volunteers. Feb 23, 2009 at 18:11
  • 1
    Exact duplicate of many, many quine questions on SO: stackoverflow.com/search?q=quine
    – Adam Davis
    Feb 23, 2009 at 18:14
  • No problem. Don't worry about deleting it - it will help others when they try to post the same question by showing up as a suggestion when they enter a new question title.
    – Adam Davis
    Feb 23, 2009 at 18:16

7 Answers 7

4

look up Quines.

1

You are wanting to read about quines. See here.

1

http://en.wikipedia.org/wiki/Quine_(computing)

0

http://en.wikipedia.org/wiki/Quine_(computing)

http://www.nyx.net/~gthompso/quine.htm

0

There are an infinite number ways to do this. All you have to do is find one way and then add comments....

Not the answer you're looking for? Browse other questions tagged or ask your own question.