Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以使用反射 API 在 Java 中编写一个 quine(其输出为自身的程序)来访问 quine 的代码,然后将其打印出来?即使添加了对输出没有影响的随机行,这样的程序仍然可以准确地打印出来。
我不这么认为。反射 api 不提供对实际源代码的访问,而只提供对类和成员定义的访问。