日期:2014-05-20 浏览次数:20809 次
pullic class ThreadCooperation
{
public static void main(String[] args)
{
ExecutorService executor = Executors.newFixedThreadPool(2);
//DepositTask、WithdrawTask是实现了Runnable接口的类,都定义了run()方法。
executor.execute(new DepositTask());
executor.execute(new WithdrawTask());
System.out.println("...(略)");
}
}