Skip to content

Instantly share code, notes, and snippets.

@benjholla
Created January 27, 2016 02:25
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benjholla/9dd76ca9269e8c9af99a to your computer and use it in GitHub Desktop.
Save benjholla/9dd76ca9269e8c9af99a to your computer and use it in GitHub Desktop.
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]);
}
}
}
@IgNaCy07
Copy link

Pretty much exactly how I write my quines

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment