Java-多线程-Thread类-实现Runnable类
package cn.bruce.Thread; //实现接口方式的线程 //创建Thread类对象,构造方法中,传递Runnable接口实现类 //调用Thread类的方法start() public class RunnableDemo { public static void main(String[] args) { Runnabletest test = new Runnabletest(); Thread t = new Thread(test);//需要将实现类传至Thread构造方法实现 t.start(); for (int i = 0; i < 10; i++) { System.out.println("main..."+i); } } } class Runnabletest implements Runnable { public void run() { for (int i = 0; i < 11; i++) { System.out.println("run..."+i); } } }