Top Posters
Since Sunday
w
5
a
3
j
2
a
2
t
2
u
2
r
2
j
2
j
2
l
2
d
2
y
2
New Topic  
fattykay92 fattykay92
wrote...
Posts: 467
4 years ago
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 would work if you delete the method m2 from the interface T.

▸ The program displays Action 1.

▸ The program has a compile error because T is not a functional interface. T contains multiple methods.

▸ The program has a runtime error because T is not a functional interface. T contains multiple methods.
Textbook 
Introduction to Java Programming, Comprehensive Version

Introduction to Java Programming, Comprehensive Version


Edition: 10th
Author:
Read 75 times
1 Reply
Replies
Answer verified by a subject expert
Va97001Va97001
wrote...
Posts: 395
4 years ago
Sign in or Sign up in seconds to unlock everything for free
More solutions for this book are available here
1

Related Topics

fattykay92 Author
wrote...

4 years ago
Smart ... Thanks!
wrote...

Yesterday
I appreciate what you did here, answered it right Smiling Face with Open Mouth
wrote...

2 hours ago
this is exactly what I needed
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  1240 People Browsing
Related Images
  
 342
  
 349
  
 70
Your Opinion
Who will win the 2024 president election?
Votes: 119
Closes: November 4