Illustration einer tropischen Insel mit Palmen und einem hohen Berg

Java Blog für Programmierer

Shortest Java Quine with 106 chars

· Christian Ullenboom

Because of a contest in a German Java forum I tried to formulate the shortest Java Quine:

enum _{_;{String _="enum _{_;{String _=%c%s%1$c;System.out.printf(_,34,_);}}";System.out.printf(_,34,_);}}

To compile and run under Windows (with Unix you need to redirect Exceptions to /dev/null and use diff):

>javac _.java >java _ 2> NUL > Quine.out > fc Quine.out _.java Vergleichen der Dateien Quine.out und _.JAVA FC: Keine Unterschiede gefunden >jrunscript -e "print(new java.io.File('_.java').length())"106

I haven’t found a shorter solution on the net, so I suppose this is the shortest for now.

Kategorien: Allgemein

← Alle Beiträge