如何输出代码本身?
有多少种方法可以让代码自行输出?
例如,编写下面的代码,
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
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
这称为编程 quine,并且已在 SO 上进行了广泛讨论:
https://stackoverflow.com/search?q=quine
另请参阅
http://en.wikipedia.org/wiki/Quine_(computing)< /a>
http://www.nyx.net/~gthompso/quine.htm
http://www.madore.org/~david/computers/quine. html
- 亚当
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
查找奎因。
look up Quines.
您想阅读有关奎因的内容。 请参阅此处。
You are wanting to read about quines. See here.
http://en.wikipedia.org/wiki/Quine_(计算)
http://en.wikipedia.org/wiki/Quine_(computing)
http://en.wikipedia.org/wiki/Quine_(计算)
< a href="http://www.nyx.net/~gthompso/quine.htm" rel="nofollow noreferrer">http://www.nyx.net/~gthompso/quine.htm
http://en.wikipedia.org/wiki/Quine_(computing)
http://www.nyx.net/~gthompso/quine.htm
这个问题不是已经被问过了吗?
Hasn't this question already been asked?
有无数种方法可以做到这一点。 您所要做的就是找到一种方法,然后添加评论......
There are an infinite number ways to do this. All you have to do is find one way and then add comments....