Consider following interface.
interface Runnable{ | |
public void run(); | |
} |
Which of the following will create instance of Runnable type?
A.
Runnable run = () -> {System.out.println("Run");}; |
Runnable run = () -> System.out.println("Run"); |
Runnable run = () > System.out.println("Run"); |
Runnable run = > System.out.println("Run"); |
題解
Java 8導入了Lambda語法,可以參考這篇文章來學習: