concept static type in category java

appears as: static types, static type, static types
The Well-Grounded Java Developer

This is an excerpt from Manning's book The Well-Grounded Java Developer.

  • Variables, dynamic versus static types, and scoping
  • 8.2.3. Variables, dynamic versus static types, and scoping

    As Groovy is a dynamic language that’s capable of being a scripting language, there are some nuances about dynamic versus static types and about how variables are scoped that you need to know about.

    Using dynamic types can have the benefits of terser code (omitting “obvious” types), faster feedback, and the flexibility to assign different types of objects to a single variable that you want to execute work on. For those who like to be more sure about what type they’re using, Groovy does support static types as well. For example:

    Date x = new Date();

    The Groovy runtime can detect if you have declared a static type and then try to assign an incorrect type to it, for example.