package cn.itcast.day_05.test_01; public class Thread01 { public static void main(String[] args) { //继承 new Thread(){ @Override public void run() { for (int i = 0 ; i < 10 ; i++){ System.out.println(Thread.currentThread().getName() + "--->"+ "黑马"); } } }.start(); //接口 Runnable r = new Runnable() { @Override public void run() { for (int i = 0 ; i < 10 ; i++){ System.out.println(Thread.currentThread().getName() + "--->"+ "程序员"); } } }; new Thread(r).start(); //简化接口的方式 new Thread( new Runnable() { @Override public void run() { for (int i = 0 ; i < 10 ; i++){ System.out.println(Thread.currentThread().getName() + "--->"+ "传智播客"); } } } ).start(); } }