I recently saw some questions on SO that asked if you could make a Hello World program without using any semi colons using C#. The challenge is to do this again, but in the shortest amount of code possible!
C# (114)
Note that the proper index for Demo: http://ideone.com/5npky ( |
|||
C# 85 chars
class H{static void Main(){if(System.Console.Out.WriteAsync("Hello, world!")is H){}}} |
|||
115 Bytes
It's likely possible to produce something a bit shorter, but I'm pretty sure that you're going to need make some sort of asynchronous call. |
||||
|
|
C,
|
|
|||
|
Java (
|
How about class H{static void main... Not sure if that trick applies to Java as well :) – mellamokb Apr 23 '12 at 20:18 |
|
Nope, that's not allowed: main should be public, or at least my compiler tells me so. Strangely enough, the class doesn't need to be. – AardvarkSoup Apr 23 '12 at 20:33 |
|
You can actually make it shorter by using a static block if you ignore the output to stderr: class H{static{if(System.out.append("Hello world").equals(0)){}}} :) – mellamokb Apr 24 '12 at 3:15 |
|
|
|
You can save 1 char by replacing == with a one-character comparison operator. – Peter Taylor Apr 19 '12 at 9:42 |
||
I also removed the space between puts and the string. puts'Hello World' is valid ruby code – w0lf Apr 19 '12 at 9:49 |
|
In C#. 95 chars
|
|||||||||||
|
'Hello World'is a valid GolfScript program that printsHello World. Although HQ9+ will easily beat it.) – Ilmari Karonen Apr 17 '12 at 14:51