1 Star 0 Fork 0

ThisYoung/OnJava8-Examples

Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
RunnableMethodReference.java 684 Bytes
Copy Edit Raw Blame History
Bruce Eckel authored 2016-12-31 09:23 +08:00 . Date change
// functional/RunnableMethodReference.java
// (c)2017 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information.
// Method references with interface Runnable
class Go {
static void go() {
System.out.println("Go::go()");
}
}
public class RunnableMethodReference {
public static void main(String[] args) {
new Thread(new Runnable() {
public void run() {
System.out.println("Anonymous");
}
}).start();
new Thread(
() -> System.out.println("lambda")
).start();
new Thread(Go::go).start();
}
}
/* Output:
Anonymous
lambda
Go::go()
*/
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/thisyoung/OnJava8-Examples.git
git@gitee.com:thisyoung/OnJava8-Examples.git
thisyoung
OnJava8-Examples
OnJava8-Examples
master

Search