Package modernfeatures.lambda
Class LambdaWithParameterExample
java.lang.Object
modernfeatures.lambda.LambdaWithParameterExample
This class demonstrates the use of lambda expressions with parameters in Java. It shows how to create and invoke lambda expressions with implicit and explicit parameter types, and how to reuse lambda expressions.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
LambdaWithParameterExample
public LambdaWithParameterExample()Default constructor.
-
-
Method Details
-
main
The entry point of the application.This method performs the following steps:
- Creates a lambda expression with an implicit parameter type to print a message.
- Invokes the lambda expression with a sample message.
- Creates another lambda expression with an explicit parameter type and parentheses.
- Invokes the second lambda expression with a different message.
- Reuses the first lambda expression to print another message.
- Parameters:
args
- the command-line arguments passed to the program
-