Skip to content

Instantly share code, notes, and snippets.

@benjholla benjholla/Quine.java
Created Jan 27, 2016

Embed
What would you like to do?
A simple quine program implementation in Java
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
You can’t perform that action at this time.