Can anyone tell me how to write a java program that print itself without using file IO. I googled a lot, but I can't find the exact answer. I found some useful tips here . Is there any way to write self print program without using file IO ?
Asked
Active
Viewed 231 times
1 Answers
-1
Here you can find many implementations, the first by Bertram Felgenhauer follows:
class S{public static void main(String[]a){String s="class S{public static void main(String[]a){String s=;char c=34;System.out.println(s.substring(0,52)+c+s+c+s.substring(52));}}";char c=34;System.out.println(s.substring(0,52)+c+s+c+s.substring(52));}}
By the way, this is known as a quine, a program whose output is itself.
-
@frhack I have taken it from the link. It is not my original creation :p – xrisk Jun 28 '15 at 06:26
-