All Downloads are FREE. Search and download functionalities are using the official Maven repository.

reference.language.method.html Maven / Gradle / Ivy




    
    Method expressions
    
    

    
    

    
    

    
    
    
    

    


Method expressions

Method expressions are expressions used to convey method definitions.
A method expression is a code fragment which produces a Method value, whose exact type is determined by the method prototype, and which can then be used as an input for method invocations.
A method expression has the following form:

  • In O or M: name (without parenthesis), where name is the name of a concrete method.
  • In E: Method: name where name is the name of a concrete method.
Method values are not storable.

In the below example, we declare a prototype myProto.
We then define a method printResultOfMyProto which accepts myProto as a parameter type.
Later on, we define a method myMethod, which happens to have the same prototype as myProto.
Finally, in the main method, we instantiate a Method expression, which can be used as a parameter when calling printResultOfMyProto.





© 2015 - 2025 Weber Informatics LLC | Privacy Policy