A thread is a unit of program execution that runs independently from other threads. Java programs can consist of multiple threads of execution that behave as if they were running on independent CPUs.
java.lang.Threadis the Thread class representing a thread, which you can extend and then override its run() method. Afterwards, you call start().java.lang.Runnableis a functional interface (meaning only one method) which you can implement and then override run(). Afterwards, you can pass the object to a Thread instance and run start().- The
synchronizedkeyword is a modifier that can be used to write blocks of code, methods, or other resources to protect it in a multithreaded environment. wait()andnotify()ornotifyAll()methods ofjava.lang.Objectcan be used to suspend or wake up threads.