import java.lang.Thread; //引入线程类标签:...,helloThread,Java,Thread,接口,线程,public,testThread From: https://blog.51cto.com/softo/6022979
public class MyThread {
public static void main(String[] args) {
//用实现线程接口的类创建线程并执行线程
testThread helloThread =new testThread();
Thread myThread=new Thread(helloThread); //注意构造函数的写法
myThread.start(); //执行线程
}
}
//实现线程接口的类
class testThread implements Runnable{
//重写接口Runnable中的方法
public void run() {
System.out.println("Hello Thread! 2011.12.2 Friday By friendan!");
}
}