摘要:
1 //实现Runnable,编写购票线程 2 public class MyRunnable implements Runnable{ 3 private int i; 4 @Override 5 public void run() { 6 // TODO Auto-generated metho 阅读全文
摘要:
1 //接力赛跑的线程,实现Runnable 2 public class MyRunnable implements Runnable{ 3 static int num = 10; 4 private String thread; 5 Object lock = new Object(); 6 阅读全文
摘要:
1 //实现Runnable,编写VIP病人看病线程 2 public class MyRunnable implements Runnable{ 3 private int num ; 4 public void run() { 5 while(true) { 6 if(num == 10) { 阅读全文
摘要:
1 //Runnable的实现类,实现爬山的功能 2 public class ClimbThread implements Runnable{ 3 private int time; 4 private int num = 5; 5 6 public ClimbThread(int time) { 阅读全文
摘要:
1 //继承Thread类 2 public class MyThread extends Thread { 3 //重写run方法 4 public void run() { 5 for(int i = 0;i<20;i++) { 6 System.out.println("你好,来自线程"+Th 阅读全文