هل تقصد الMultithreading
هذا مثال لكود بالجافا
public class Multithreading {
public static void main(String[] args) {
Task t1 = new Task("reading a book");
Task t2 = new Task("watching TV");
Task t3 = new Task("working out");
t1.start();
t2.start();
t3.start();
}
}
class Task extends Thread{
String taskName;
public Task(String task_name){
taskName = task_name;
}
public void run(){
for(int i=0; i<10; i++){
System.out.println(taskName + " - " + i);
}
}
}