This is an old revision of the document!
Table of Contents
Java8 Lambda Use cases
Runnable
Instead using
public class RunnableTest { public static void main(String[] args) { System.out.println("=== RunnableTest ==="); Runnable r = new Runnable(){ @Override public void run(){ System.out.println("Hello world one!"); } }; r.run(); } }
Use
public class RunnableTest { public static void main(String[] args) { System.out.println("=== RunnableTest ==="); Runnable r = () -> System.out.println("Hello world two!"); r.run(); } }