摘要: public class Foo {private int x = 100;public synchronized int getX(){ System.out.println("getx"+x); return x;}public int getY(int y){synchronized (this) {x=x-y;System.out.println("gety"+x); return x;}}}public class MyThread implements Runnable{ private Foo foo= new Foo(); public 阅读全文
posted @ 2012-11-28 17:05 合肥房屋托管 阅读(197) 评论(0) 推荐(0)
摘要: Thread的非静态方法join()让一个线程B‘加入’到另一个线程A的尾部,在A执行完之前,B不能工作。Thread t =new MyThread();t.start();t.join();另外,jion()还有带超时限制的重载版本。例如,t.join(1000); 阅读全文
posted @ 2012-11-28 15:59 合肥房屋托管 阅读(165) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2012-11-28 15:46 合肥房屋托管 阅读(137) 评论(0) 推荐(0)
摘要: 第一个jquery程序:<title>第一个jquery程序</title><script src="../js/jquery-1.8.3.js" type="text/javascript"></script><script type="text/javascript">$(document).ready(function(){alert("hello jquery");});//$(document).ready(function(){})可以简写成$ 阅读全文
posted @ 2012-11-28 14:10 合肥房屋托管 阅读(189) 评论(0) 推荐(0)