Created
January 27, 2016 02:25
-
-
Save benjholla/9dd76ca9269e8c9af99a to your computer and use it in GitHub Desktop.
A simple quine program implementation in Java
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
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 = {", | |
" };", | |
" for(int i=0; i<4; i++){", | |
" System.out.println(code[i]);", | |
" }", | |
" for(int i=0; i<code.length; i++){", | |
" System.out.println(quote + code[i] + quote + ',');", | |
" }", | |
" for(int i=4; i<code.length; i++){", | |
" System.out.println(code[i]);", | |
" }", | |
" }", | |
"}", | |
}; | |
for(int i=0; i<4; i++){ | |
System.out.println(code[i]); | |
} | |
for(int i=0; i<code.length; i++){ | |
System.out.println(quote + code[i] + quote + ','); | |
} | |
for(int i=4; i<code.length; i++){ | |
System.out.println(code[i]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Pretty much exactly how I write my quines