Skip to main content


Showing posts from June 3, 2016


DOING JAVA IN GROOVY STYLE1-1:Hello, World!The Groovy version of "Hello, World!" is more easier: class MyGroovyClass { static def main(args){ println "Hello, World!" } }

1-2:Packages and Classes imported implicitly Groovy will import the following packages and classes implicitly, so you can use any class in these packages without package prefix:java.lang.*java.util.***groovy.lang.*groovy.util.*java.math.BigIntegerjava.math.BigDecimal BigInteger bi=2

1-3:Syntax simplified The syntax of Goovy is simplified greatly:System.out.println => printlnSystem.out.print => printIf the number of arguments is greater than 1, you can omit parenthesis, such as: a.f p1,p2Return is optional, when it is lost, the value of the last statement will be returned.Semicolon is optional. But if there are more than one statement in a line, you should use it.Property, method, Class is automatically public scope. println "Groovy is cool!"