package main
import "fmt"
func main() {
// 单行注释
/*
多行注释
*/
fmt.Println("Hello, World!")
}
go run: cannot run non-main package
# command-line-arguments ./hello_world.go:4: imported and not used: "flag"
# command-line-arguments runtime.main: call to external function main.main runtime.main: main.main: not defined runtime.main: undefined: main.main
xxx {
yyyy
}
# command-line-arguments
./hello_world.go:6: syntax error: unexpected semicolon or newline before {
public class Test {
public static void main(String args[]) {
System.out.println("hello world !");
}
}
原文:http://www.cnblogs.com/sten/p/5617003.html