import Java.io.*; //多线程编程 public class MultiThread { public static void main(String args[]) { System.out.println("我是主线程!"); //下面创建线程实" />
龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > 软件开发 > JAVA开发 >

多线程学习初步

时间:2009-12-23 15:42来源:未知 作者:admin 点击:
分享到:
?XML:namespace prefix = o ns = "urn:schemas-microsoft-com:Office:office" /> import Java.io.*; //多线程编程 public class MultiThread { public static void main(String args[]) { System.out.println("我是主线程!"); //下面创建线程实

<?XML:namespace prefix = o ns = "urn:schemas-microsoft-com:Office:office" /> 


  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
  //优先级将决定


  
精彩图集

赞助商链接