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