PDA

View Full Version : Shortest Hello World?



Trinithis
01-22-2008, 09:08 PM
Removing excess whitespace, is this the shortest hello world program one can make in Java?



enum X {
X;
X() {
System.out.print("Hello World!");
}
}


Or without throwing an error:



enum X {
X;
X() {
System.out.print("Hello World!");
System.exit(0);
}
}


Any thoughts? Just curious if anyone can devise a smaller version. (I came up with the enum version after seeing one using static initializers.)