package com.lovecoding.day14.thread02;

public class TestThread03 {

    public static void main(String[] args) throws InterruptedException {
        //主线程中
        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 100; i++) {
                    System.out.println(" java ");
                }
            }
        });

        Thread t2 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 100; i++) {
                    System.out.println(" c++ ");
                }
            }
        });
        //设置优先级
        t1.setPriority(10);
        t2.setPriority(1);

        t1.start();
        t2.start();

        //main 获取名称
        //获取当前线程的名称
        System.out.println(Thread.currentThread().getName()+"主线程");


    }
}
