Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: markspace <-@.> Newsgroups: comp.lang.java.programmer Subject: Re: "Small" Program Challenge. Date: Wed, 13 Jun 2012 17:40:17 -0700 Organization: A noiseless patient Spider Lines: 26 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 14 Jun 2012 00:40:18 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="FdGtJfjpuT9sCWzMTZR2Fw"; logging-data="29460"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+9H6TZpvKOtXjt7BoUf2oh6DvmYTjnE8w=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 In-Reply-To: Cancel-Lock: sha1:JcCUzS15cpKI3GmoBeNNySS8mS0= Xref: csiph.com comp.lang.java.programmer:15262 On 6/13/2012 1:52 PM, Daniel Pitts wrote: > On 6/13/12 1:45 PM, Daniel Pitts wrote: >> I saw a challenge Roedy posted on cljh, and I thought I might have a >> slightly more interesting one. >> >> Write a Java program which outputs "Hello World" followed by a new line >> (and nothing else). >> >> Now, do it using as few characters in the .java source code as possible. >> >> I've got mine down to 61 characters. See if you can match that. > > Hint, the following is 82 characters, if you remove line wrapping. Where > do I trim the 21 characters? > > "class M{public static void main(String[]args){System.out.println("Hello > World");}}" This is a good one, although the options for really trimming things down in surprising ways is absent in Java. Another good one is to write a Java program that prints its own source text. No fair using an external file, of course.