Question: Analyze the following code: ` ` ` public class Test { public static void main ( String [ ] args ) { Test test =

Analyze the following code:
```
public class Test {
public static void main(String[] args){
Test test = new Test();
test.setAction(()-> System.out.print("Action 1!"));
}
public void setAction(T t){
t.m1();
}
}
interface T {
public void m1();
public void m2();
}
```
The program has a compile error because \( T \) is not a functional interface. \( T \) contains multiple methods.
The program displays Action 1.
The program would work if you delete the method m 2 from the interface \( T \).
The program has a runtime error because T is not a functional interface. T contains multiple methods.
Analyze the following code: ` ` ` public class

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 Programming Questions!