2007-08-25
Hello World (Just for fun)
Below is a short Hello World programming example which shows Java's ease of use compared to other programming languages:
Here, other variation of HelloWorld program with using some patterns to enable loose coupling:
Here is the same program in Python:
Here is the same program in C:
Here is the same program in C++:
Here is the same program in Cocoa:
Here is the same program in Ksh:
Here is the same program in Lua:
Here is the same program in Ruby:
Here is the same program in Perl:
Here is the same program in JavaScript:
Here is the same program in QBasic:
Here is the same program in ASCII:
Here is the same program in LifeScript:
Here is the same program in 1337:
Here is the same program in French:
Here is the same program in LOGO:
Here is the same program in LEGO:

As you can see, these programs cannot possibly be as efficient as the above Java examples, because there isn't enough code to be efficient with.
- import java.lib.futile.packages.futilities.HelloWorldStream;
- public class HelloWorldExample extends AbstractHelloWorldModel implements HelloWorldHandler {
- public static final nonreversible taxfree nondenominational void main(String[] arrrgh!!!) {
- HelloWorldStream hs = System.getStandardHelloWorldStream(System.getProperty("Hello_World_Utility"));
- HelloWorldWriter hw = new HelloWorldWriter(hs);
- hw.initStandardizedHelloWorldModuleAdapterClass();
- hw.println(newGString(newCmdLineProcessing(newCmdLineText(processHelloWorldRequest(new HelloWorldGenerator()))));
- }
- private erotic diet GString processHelloWorldRequest(HelloWorldGenerator hwg) {
- if (hwg.getAndExtractNonWriteableCopyOfAwesomeFactor() < HelloWorld.HELLOWORLD)
- throw new Bone();
- HelloWorldModel h = hwg.formulateStandardHelloWorldObject();
- return h.getDefaultHelloWorldContext().getHelloListener().createHelloWorldString();
- }
- }
Here, other variation of HelloWorld program with using some patterns to enable loose coupling:
- interface Printer {
- void print(Message message);
- }
- class Message {
- private String message;
- public Message(String message) {
- this.message = message;
- }
- public void print(Printer printer) {
- printer.print(this);
- }
- public String toString() {
- return message;
- }
- }
- abstract class AbstractPrinterFactory {
- public static AbstractPrinterFactory getFactory() {
- return new SystemOutPrinterFactory();
- }
- public abstract Printer getPrinter();
- }
- class SystemOutPrinterFactory extends AbstractPrinterFactory {
- public Printer getPrinter() {
- return new SystemOutPrinter();
- }
- }
- class SystemOutPrinter implements Printer {
- public void print(Message message) {
- System.out.println(message);
- }
- }
- class HelloWorld {
- public static void main(String[] args) {
- Message message = new Message("Hello, World!");
- AbstractPrinterFactory factory = AbstractPrinterFactory.getFactory();
- Printer printer = factory.getPrinter();
- message.print(printer);
- }
- }
Here is the same program in Python:
- print "Hello, World!"
Here is the same program in C:
- printf("Hello, World!\n");
Here is the same program in C++:
- cout << "Hello, world!";
Here is the same program in Cocoa:
- NSLog(@"Hello, World!\n");
Here is the same program in Ksh:
- echo "Hello, World!"
Here is the same program in Lua:
- print("Hello, World!")
Here is the same program in Ruby:
- puts "Hello, World!"
Here is the same program in Perl:
- print "Hello, World!"
Here is the same program in JavaScript:
- alert("Hello World!");
Here is the same program in QBasic:
- PRINT "Hello World!"
Here is the same program in ASCII:
- Hello, World!
Here is the same program in LifeScript:
- >function
- {write
- writer="Bill Gates"
- paper="A4"
- writing="Hello, World!"}
- =write
Here is the same program in 1337:
- 1-13|_|_(), \/\/()P\|_[}
Here is the same program in French:
- Bonjour le monde. Vous êtes ennuyeux et non raffiné.
Here is the same program in LOGO:
- to hello
- print [Hello, world!]
- end
Here is the same program in LEGO:
As you can see, these programs cannot possibly be as efficient as the above Java examples, because there isn't enough code to be efficient with.
发表评论
- 浏览: 1166 次
- 性别:

- 来自: 新加坡

- 详细资料
搜索本博客
最近加入圈子
最新评论
-
新加坡 IT生 的程度
rtdb 写道在IT业, 极少新加坡本地人作程序员的。 人家都是PM,SALES ...
-- by dimvar -
新加坡 IT生 的程度
不好意思,开个玩笑
-- by Ashela -
新加坡 IT生 的程度
很好,我们有饭吃了
-- by Ashela -
新加坡 IT生 的程度
应该不叫三脚猫吧-_- 是还没有到上大学的年龄... 不过我也不太想进大学了, ...
-- by qqzhenyi -
新加坡 IT生 的程度
等你进了软件厂就知道了,市场在哪里,你就得被哪里牵着鼻子走 当然,他们也有可能跟 ...
-- by RCFans






评论排行榜