Skip to content

Instantly share code, notes, and snippets.

@smamran
Last active June 5, 2016 12:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smamran/1108bc7f7d272aef2609 to your computer and use it in GitHub Desktop.
Save smamran/1108bc7f7d272aef2609 to your computer and use it in GitHub Desktop.
Java 8 Thread Creation

Java 8 Thread Create

class Main
{
    public static void main(String args[])
    {
        Runnable task = () -> {
            String threadName = Thread.currentThread().getName();
            System.out.println(threadName);
        };
        task.run();
        Thread thread = new Thread(task);
        thread.start();
        System.out.println("Done!!");
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment