Question: Please write a short code on the below Write an equivalent lambda expression that can be used to replace the anonymous inner class below. An

Please write a short code on the below

Write an equivalent lambda expression that can be used to replace the anonymous inner class below. An example inner anonymous class implementation is below. The body of the lambda expression implementation must match the implementation shown in the class.

public class ClassThatDoesSomething {

public static void main (String[] args) {

ClassThatDoesSomething ctds = new ClassThatDoesSomething()'

ctds.cmp(new EQ() {

public boolean eq(char c1, char c2) {

}

});

}

public void cmp(EQ test) {

test.eq('t), 'T');

}

}

interface EQ {

public boolean eq(char c1, char c2);

}

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!