Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Semicolons are optional. Use them if you like (though you must use them to put several statements on one line).
  • The return keyword is optional.
  • You can use the this keyword inside static methods (which refers to this class).
  • Methods and classes are public by default.
  • Protected in Groovy has the same meaning as protected in Java, i.e. you can have friends in the same package and derived classes can also see protected members.
  • Inner (non-static nested) classes are not supported. In most cases you can use closures instead, e.g. to implement interfaces. Static nested classes are supported.
  • The throws clause in a method signature is not checked by the Groovy compiler, because there is no difference between checked and unchecked exceptions.
  • You will not get compile errors like you would in Java for using undefined members or passing arguments of the wrong type. See Runtime vs Compile time, Static vs Dynamic.

...