用NETBEANS做的一个关于Java的小小的demo.大家赐教

源代码在线查看: componentthread.java

软件大小: 60 K
上传用户: ying_min
关键词: NETBEANS Java demo
下载地址: 免注册下载 普通下载 VIP

相关代码

				/*
				 * ComponentThread.java
				 *
				 * Created on 2007年9月14日, 下午12:43
				 *
				 * To change this template, choose Tools | Template Manager
				 * and open the template in the editor.
				 */
				
				package semaphore;
				
				import java.util.concurrent.CountDownLatch;
				
				/**
				 *
				 * @author Administrator
				 */
				public class ComponentThread implements Runnable{
				    CountDownLatch latch;
				    int ID;
				    /** Creates a new instance of ComponentThread */
				    public ComponentThread(CountDownLatch latch, int ID) {
				        this.latch = latch;
				        this.ID = ID;
				    }
				    public void run() {
				        System.out.println("Component "+ID + " initialized!");
				        //将计数减一
				        latch.countDown();
				    }
				}
							

相关资源