Multithreading एक Java program को कई threads को समवर्ती रूप से चलाने देती है, जिससे parallelism (कई CPU cores का उपयोग) और responsiveness (block किए बिना काम करना) संभव होती है। Java में first-class thread support है — लेकिन shared mutable state जटिलता (race conditions) पेश करता है जिसे सावधानी से प्रबंधित किया जाना चाहिए।
threads बनाना
() -> System.out.println( + Thread.currentThread().getName());
(task);
t.start();
Executors.newFixedThreadPool();
executor.submit(task);
