1.多线程编程实例
publicclass RunnableTest {
publicstaticvoid main(String[] args) {
Runnable runnable=
new
MyThread();
new
Thread(runnable).start();
new
Thread(runnable).start();
new
Thread(runnable).start();
new
Thread(runnable).start();
}
publicstaticclass MyThread
implements
Runnable{
//车票数量
privateint tickets=
100
;
publicvoid run() {
while
(tickets>
0
){
System.out.println(Thread.currentThread().getName()+
"卖出第 【"
+tickets--+
"】张火车票"
);
}
}
}
}
2.
java中的匿名内部类总结
网址:http://www.cnblogs.com/nerxious/archive/2013/01/25/2876489.html
http://blog.csdn.net/kkkloveyou/article/details/6724083