Thread (二)线程启动

 

package com.dragon.test2;

public class Test {
public static void main(String[] args) {
//创建实现Runnable类的线程的对象
RunnableTest runnableTest = new RunnableTest();
//创建线程
Thread thread = new Thread(runnableTest);
//启动线程
thread.start();
}
}
/**
* 线程类
* @author Administrator
*
*/
class RunnableTest implements Runnable{
////////////一个类可以实现多个接口但是只能继承一个父类

@Override
public void run() {
// TODO Auto-generated method stub
System.out.println("启动线程@!!");
}

}

 
 

你可能感兴趣的:(thread)