0

有多少种方法可以让代码自己输出?

例如,编写下面的代码,

public class Test
{
   public static void main(String[] args)
   {
      // some code
   }
}

输出自己

public class Test
{
   public static void main(String[] args)
   {
      // some code
   }
}

(接受任何编程语言)

编辑这个问题已在历史帖子中得到解答,搜索“quine”或查看https://stackoverflow.com/search?q=quine

4

7 回答 7

12

这被称为编程 quine,并已在 SO 上进行了广泛讨论:

https://stackoverflow.com/search?q=quine

另见

http://en.wikipedia.org/wiki/Quine_(计算)

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

http://www.madore.org/~david/computers/quine.html

-亚当

于 2009-02-23T18:11:27.223 回答
4

查查奎因斯

于 2009-02-23T18:10:59.550 回答
1

您想阅读有关 quines 的信息。见这里

于 2009-02-23T18:11:53.213 回答
1

http://en.wikipedia.org/wiki/Quine_(计算)

于 2009-02-23T18:12:59.233 回答
0

http://en.wikipedia.org/wiki/Quine_(计算)

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

于 2009-02-23T18:12:32.697 回答
0

这个问题不是已经问了吗?

于 2009-02-23T18:15:48.040 回答
0

有无数种方法可以做到这一点。您所要做的就是找到一种方法,然后添加评论......

于 2009-02-23T18:19:42.370 回答