@Test public void add() { //方式一 Thread thread1 = new Thread("ttt") { @Override public void run() { System.out.println("1"); } }; thread1.start(); //方式二 Runnable runnable = new Runnable() { @Override public void run() { System.out.println("2"); } }; Thread thread2 = new Thread(runnable); thread2.start(); //方式三 Thread thread3 = new Thread(() -> { System.out.println("*********"); }); thread3.start(); }