Groovy


Groovy (正體)

Free Web Hosting with Website Builder

Groovy,在计算技术中是一种面向对象脚本语言,作为 Java 程序设计语言的一种扩展,并增加了 PythonRubySmalltalk 中的一些特性。

编译器将 Groovy 语言转换成 Java 字节码。

程式范例

下面是来自于 http://Groovy.CodeHaus.org 的一个例子程序:

class Foo {
  doSomething() {
    data = ["name": "James", "location": "London"]
    for (e in data) {
      println("entry ${e.key} is ${e.value}")
    }
  }
 
  closureExample(collection) {
    collection.each { println("value ${it}") }
  }
 
  static void main(args) {
    values = [1, 2, 3, "abc"]
    foo = new Foo()
    foo.closureExample(values)
    foo.doSomething()
  }
}

外部链接







Why are we here?
All text is available under the terms of the GNU Free Documentation License
This page is cache of Wikipedia. History