多线程帮个忙 刚学多线程不太懂

img

用什么实现,java还是c语言。



public class 线程测试 {

    public static void main(String[] args) {

        System.out.println("********显示默认优先级*******");
        System.out.println("主线程名称:"+Thread.currentThread().getName()+",优先级:"+Thread.currentThread().getPriority());
        MyThread thread = new MyThread();
        thread.setPriority(5);
        thread.start();
        System.out.println("********修改默认优先级*******");
        Thread.currentThread().setPriority(10);
        System.out.println("主线程名称:"+Thread.currentThread().getName()+",优先级:"+Thread.currentThread().getPriority());
        thread = new MyThread();
        thread.setPriority(1);
        thread.start();
    }

}
class MyThread extends Thread{
    
    @Override
    public void run() {
        System.out.println("子线程名称:"+Thread.currentThread().getName()+",优先级"+this.getPriority());
    }
}