这个代码运行后显示台最上面为什么没有main-->5?能够给我解答一下吗?谢谢了
需要在main线程中进行打印
public static void main(String[] args) {
Runnable task = () -> System.out.println(Thread.currentThread().getName() + " -- " + Thread.currentThread().getPriority());
Thread t1 = new Thread(task);
Thread t2 = new Thread(task);
System.out.println(Thread.currentThread().getName() + " -- " + Thread.currentThread().getPriority());
t1.start();
t2.setPriority(1);
t2.start();
}