A thread is an independent path of execution within a program. Every Java program starts with a main thread, and you can create more to do work concurrently. The work itself is usually described by a Runnable, a functional interface with one method, void run(), which takes no arguments, returns nothing and cannot throw checked exceptions. Because it is functional, a lambda works: Runnable task = () -> System.out.println("working");.
Keep reading for free
Create a free StudyToCert account to read the rest of this lesson: 5 more sections, 5 key terms, a real-world example, an exam tip and self-check questions. Every lesson, lab and practice test is free with an account.