-
-
Save benjholla/5f57727305e52c84d515656ec617bfdd to your computer and use it in GitHub Desktop.
A simple quine using substring operations with an example runner script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This quine ignores whitespace and comments | |
* It could be run with the following bash script | |
* | |
* ---------------------------------------------- | |
* #!/bin/bash | |
* while true; do | |
* rm -f Quine.class | |
* javac Quine.java | |
* rm -f Quine.java | |
* java Quine &> Quine.java | |
* done | |
* ---------------------------------------------- | |
* | |
* @author Ben Holland | |
*/ | |
public class Quine { | |
public static void main(String[] args) { | |
char quote = 34; | |
String code = "public class Quine { public static void main(String[] args) { char quote = 34; String code = ;System.out.print(code.substring(0,92) + quote + code + quote + code.substring(92,code.length())); } }"; | |
System.out.print(code.substring(0,92) + quote + code + quote + code.substring(92,code.length())); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment