Below is a short Hello World programming example which shows Java's ease of use compared to other programming languages:
 
  1. import java.lib.futile.packages.futilities.HelloWorldStream;  
  2.   
  3. public class HelloWorldExample extends AbstractHelloWorldModel implements HelloWorldHandler {  
  4.   
  5.     public static final nonreversible taxfree nondenominational void main(String[] arrrgh!!!) {  
  6.         HelloWorldStream hs = System.getStandardHelloWorldStream(System.getProperty("Hello_World_Utility"));  
  7.         HelloWorldWriter hw = new HelloWorldWriter(hs);  
  8.         hw.initStandardizedHelloWorldModuleAdapterClass();  
  9.         hw.println(newGString(newCmdLineProcessing(newCmdLineText(processHelloWorldRequest(new HelloWorldGenerator()))));  
  10.     }  
  11.   
  12.     private erotic diet GString processHelloWorldRequest(HelloWorldGenerator hwg) {  
  13.         if (hwg.getAndExtractNonWriteableCopyOfAwesomeFactor() < HelloWorld.HELLOWORLD)  
  14.             throw new Bone();  
  15.         HelloWorldModel h = hwg.formulateStandardHelloWorldObject();  
  16.         return h.getDefaultHelloWorldContext().getHelloListener().createHelloWorldString();  
  17.     }  
  18. }  

Here, other variation of HelloWorld program with using some patterns to enable loose coupling:
 
  1. interface Printer {  
  2.     void print(Message message);  
  3. }  
  4.   
  5. class Message {  
  6.     private String message;  
  7.   
  8.     public Message(String message) {  
  9.         this.message = message;  
  10.     }  
  11.   
  12.     public void print(Printer printer) {  
  13.         printer.print(this);  
  14.     }  
  15.   
  16.     public String toString() {  
  17.         return message;  
  18.     }  
  19. }  
  20.   
  21. abstract class AbstractPrinterFactory {  
  22.     public static AbstractPrinterFactory getFactory() {  
  23.         return new SystemOutPrinterFactory();  
  24.     }  
  25.   
  26.     public abstract Printer getPrinter();  
  27. }  
  28.   
  29. class SystemOutPrinterFactory extends AbstractPrinterFactory {  
  30.     public Printer getPrinter() {  
  31.         return new SystemOutPrinter();  
  32.     }  
  33. }  
  34.   
  35. class SystemOutPrinter implements Printer {  
  36.     public void print(Message message) {  
  37.         System.out.println(message);  
  38.     }  
  39. }  
  40.   
  41. class HelloWorld {  
  42.     public static void main(String[] args) {  
  43.         Message message = new Message("Hello, World!");  
  44.         AbstractPrinterFactory factory = AbstractPrinterFactory.getFactory();  
  45.         Printer printer = factory.getPrinter();  
  46.         message.print(printer);  
  47.     }  
  48. }  

Here is the same program in Python:
 
  1. print "Hello, World!"  

Here is the same program in C:
 
  1. printf("Hello, World!\n");  

Here is the same program in C++:
 
  1. cout << "Hello, world!";  

Here is the same program in Cocoa:
 
  1. NSLog(@"Hello, World!\n");  

Here is the same program in Ksh:
 
  1. echo "Hello, World!"  

Here is the same program in Lua:
 
  1. print("Hello, World!")  

Here is the same program in Ruby:
 
  1. puts "Hello, World!"  

Here is the same program in Perl:
 
  1. print "Hello, World!"  

Here is the same program in JavaScript:
 
  1. alert("Hello World!");  

Here is the same program in QBasic:
 
  1. PRINT "Hello World!"  

Here is the same program in ASCII:
  1. Hello, World!  

Here is the same program in LifeScript:
 
  1. >function  
  2.  {write  
  3.  writer="Bill Gates"  
  4.  paper="A4"  
  5.  writing="Hello, World!"}  
  6. =write  

Here is the same program in 1337:
 
  1. 1-13|_|_(), \/\/()P\|_[}  

Here is the same program in French:
  1. Bonjour le monde. Vous êtes ennuyeux et non raffiné.  

Here is the same program in LOGO:
 
  1. to hello  
  2. print [Hello, world!]  
  3. 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.
  • 4288f422-216f-4265-a359-e183be8571b9-thumb
  • 描述:
  • 大小: 3.8 KB
评论
发表评论

您还没有登录,请登录后发表评论

qqzhenyi
搜索本博客
博客分类
最近加入圈子
存档
最新评论