Which lambda can replace the MySecret class to return the same value? (Choose al
ID: 3580471 • Letter: W
Question
Which lambda can replace the MySecret class to return the same value? (Choose all that apply)
interface Secret {
String magic(double d);
}
class MySecret implements Secret {
public String magic(double d) {
return "Poof";
}
}
caller((e) -> "Poof");
caller((e) -> {"Poof"});
caller((e) -> { String e = ""; "Poof" });
caller((e) -> { String e = ""; return "Poof"; });
caller((e) -> { String e = ""; return "Poof" });
caller((e) -> { String f = ""; return "Poof"; });
Explanation / Answer
Answer :
Which lambda can replace the MySecret class to return the same value? (Choose all that apply)
interface Secret {
String magic(double d);
}
class MySecret implements Secret {
public String magic(double d) {
return "Poof";
}
}
caller((e) -> "Poof");
caller((e) -> {"Poof"});
caller((e) -> { String e = ""; "Poof" });
caller((e) -> { String e = ""; return "Poof"; });
caller((e) -> { String e = ""; return "Poof" });
caller((e) -> { String f = ""; return "Poof"; });
Answer :
caller((e) -> { String e = ""; return "Poof"; });
caller((e) -> { String f = ""; return "Poof"; });
.........
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.