Skip to content

Instantly share code, notes, and snippets.

@chrisbay
Last active May 13, 2017 14:08
Show Gist options
  • Save chrisbay/6d41e1e698877b1acf1f96b80076be4d to your computer and use it in GitHub Desktop.
Save chrisbay/6d41e1e698877b1acf1f96b80076be4d to your computer and use it in GitHub Desktop.
A (cheating) quine in Java
import java.io.*;
public class Quine{
public static void main(String[] args) throws IOException {
try(BufferedReader br = new BufferedReader(new FileReader("Quine.java"))) {
StringBuilder sb = new StringBuilder();
String line;
while ((line = br.readLine()) != null) {
sb.append(line).append(System.lineSeparator());
}
System.out.print(sb.toString());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment