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
Get step-by-step solutions from verified subject matter experts
