Quines

I first heard about Quines a couple of days ago, and being a computer nerd with an instinctive desire for the bizarre, I thought I’d give it a try. Picking Java as the instrument of choice, I was disappointed to find that some of the more exotic hacks have been broken now that the JVM requires a main method declaration.

My best effort scraped in at just under the 250 char margin:

class q{public static void main(String[]m){String[]$={
"class q{public static void main(String[]m){String[]$={
","};char_=34;System.out.println($[0]+_+$[0]+_+','+_+
$[1]+_+$[1]);}}"};char_=34;System.out.println($[0]+_+
$[0]+_+','+_+$[1]+_+$[1]);}}

And for future reference, my personal Quine test routine:

$ java q > q.out && diff q.java q.out && rm q.out && wc -c q.java | awk '{print $1}'
246
03 May 2013