import java .io.*; // 多线程编程 public class MultiThread { public static void main(String args[]) { System.out.println(" 我是主线程 !"); // 下面创建线程实例" name="description" />
MILY: 宋体; mso-bidi-font-size: 13.5pt; mso-hansi-font-family: 'Times New Roman'">
import java.io.*;
//多线程编程
public class MultiThread
{
public static void main(String args[])
{
System.out.println("我是主线程!");
//下面创建线程实例thread1
ThreadUseExtends thread1=new ThreadUseExtends();
//创建thread2时以实现了Runnable接口的THhreadUseRunnable类实例为参数
Thread thread2=new Thread(new ThreadUseRunnable(),"SecondThread");
thread1.start();//启动线程thread1使之处于就绪状态
//thread1.setPriority(6);//设置thread1的优先级为6
//优先级将决定