public class LambdaExample { public static void main(String[] args) { // Using a lambda expression to implement the Runnable interface Runnable runnable = () -> System.out.println("Hello from a lambda Runnable!"); // Creating a new thread and starting it Thread thread = new Thread(runnable); thread.start(); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter