hello world程序集锦(3)
Common Lisp
;直接输出 "Hello world!"
;或者
(format t "Hello world!~%")
DOS批处理
@echo Hello, world!
对于MS-DOS 3.0或更低版本:
echo off cls echo Hello, world!
Linux Shell
echo Hello, world!
Eiffel
class HELLO_WORLD
creation
make
feature
make is
local
io:BASIC_IO
do
!!io
io.put_string("%N Hello, world!")
end -- make
end -- class HELLO_WORLD
Erlang
-module(hello).
-export([hello_world/0]).
hello_world() -> io:fwrite("Hello, World!\n").
Forth
." Hello, world!" CR
Fortran
WRITE(*,*) 'Hello, world!' STOP END
HTML
<!-- 直接輸出... --> Hello World <!-- 或者 --> <html> <head> <title> Hello World </title> </head> <body> Hello World </body> </html>
HQ9+
H INTERCAL PLEASE DO ,1 <- #13 DO ,1 SUB #1 <- #238 DO ,1 SUB #2 <- #112 DO ,1 SUB #3 <- #112 DO ,1 SUB #4 <- #0 DO ,1 SUB #5 <- #64 DO ,1 SUB #6 <- #238 DO ,1 SUB #7 <- #26 DO ,1 SUB #8 <- #248 DO ,1 SUB #9 <- #168 DO ,1 SUB #10 <- #24 DO ,1 SUB #11 <- #16 DO ,1 SUB #12 <- #158 DO ,1 SUB #13 <- #52 PLEASE READ OUT ,1 PLEASE GIVE UP
Java
public class Hello
{
public static void main(String[] args)
{
System.out.println("Hello, world!");
}
}
or in tinystruct2.0:
package tinystruct.examples;
import org.tinystruct.AbstractApplication;
import org.tinystruct.Application;
import org.tinystruct.ApplicationException;
import org.tinystruct.system.ApplicationManager;
public class hello extends AbstractApplication {
@Override
public void init() {
// TODO Auto-generated method stub
this.setAction("say", "say");
}
@Override
public String version() {
// TODO Auto-generated method stub
return null;
}
public String say(String words){
System.out.println(words);
return words;
}
/**
* @param args
* @throws ApplicationException
*/
public static void main(String[] args) throws ApplicationException {
// TODO Auto-generated method stub
// Praise to the Lord!
ApplicationManager.install(new hello());
// to print 'Hello World'
ApplicationManager.call("say/Hello World", null); // Hello World
// or...
Application app=ApplicationManager.get( hello.class.getName());
app.invoke("say", new Object[]{"<h1>Hello, World!</h1>"}); // <h1>Hello, World!</h1>
app.invoke("say", new Object[]{"<h2>Bye!</h2>"}); // <h2>Bye!</h2>
// or...
// http://localhost:8080/?q=say/Hello World
// https://github.com/m0ver/tinystruct2.0
}
}
内容版权声明:除非注明,否则皆为本站原创文章。
