Explain why closures and listeners are used in groovy.

devquora
devquora

Posted On: Feb 22, 2018

 

The open and anonymous block of code that takes arguments returns a value and can be assigned to a variable is known as a closure in Groovy. It references the variables which are declared in its surrounding scope. We know that anonymous inner classes are not supported by Groovy. Inline listeners can be determined with the help of closures. In groovy, listener closures are used as listener adapters. In this only one method which is of interest is overridden.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Groovy Interview Questions

    What do you understand by groovy?

    Groovy is an object-oriented programming language which is used for Java Virtual Machine. It is a multi-faceted languag..

    Groovy Interview Questions

    List the advantages of groovy.

    Since it is an object-oriented programming language used for Java Virtual Machine, it is very useful. Some of the advan..

    Groovy Interview Questions

    What are the limitations of Groovy?

    Everything that has advantages has some limitations too. Similarly, groovy has some limitations too. Some of the limita..