Question: Java question on lambda expression. Write the following code at two blocks between start and end comment. The following code is for you to copy

Java question on lambda expression.

Write the following code at two blocks between start and end comment.

Java question on lambda expression. Write the following code at two blocks

The following code is for you to copy and paste:

@Test void should_be_able_to_bind_to_instance_method() { // TODO: // please bind lambda to `instanceMethod()` in this class. //  assertEquals("instanceMethod", lambda.getString()); } @Test void should_be_able_to_bind_to_static_method() { // TODO: // please bind lambda to `staticMethod()` in this class. //  assertEquals("staticMethod", lambda.getString()); } private static String staticMethod() { return "staticMethod"; } private String instanceMethod() { return "instanceMethod"; }

@Test void should be able_to_bind_to_instance_method() { // TODO: // please bind Lambda to 'instanceMethod()' in this class. // assertEquals( expected: "instanceMethod", lambda.getString()); } @Test void should be able_to_bind_to_static method() { // TODO: // please bind Lambda to 'staticMethod()' in this class. // assertEquals( expected: "staticMethod", Lambda.getString()); } private static String staticMethod() { return "staticMethod"; } private String instanceMethod() { return "instanceMethod"; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!