Java SE 多线程 线程生命周期
package thread;
class ThreadTest4 implements Runnable{
private boolean flag=true;
public void stopMe(){
flag=false;
}
public void run() {
while (flag){
System.out.println(Thread.currentThread().getName()+" is running ");
}
}
}
public class ThreadLife {
public static void main(String[] args) {
ThreadTest4 tt4=new ThreadTest4();
new Thread(tt4).start();
for(int i=0;i<100;i++){
if(i==50)
tt4.stopMe();
System.out.println("i="+i+" "+Thread.currentThread().getName()+" is running ");
}
}
}
相关文档:
Java NIO API详解
在JDK
1.4以前,Java的IO操作集中在java.io这个包中,是基于流的阻塞(blocking)API。对于大多数应用来说,这样的API使用很方
便,然而,一些对性能要求较高的应用,尤其是服务端应用,往往需要一个更为有效的方式来处理IO。从JDK 1.4起,NIO
API作为一个基于缓冲区,并能提供非阻塞(non-blo ......
E:\>javac -X
-Xlint 启用建议的警告
-Xlint:{all,deprecation,unchecked,fallthrough,path,serial,finally,-deprecat ion
,-unchecked,-fallthrough,-path,-serial,-finally}启用或禁用特定的警告
& ......
package demo;
class TestA{
public int devide(int x,int y) throws ArithmeticException , DevideByMinusException{
if(y<0)
throw new DevideByMinusException("被除数为负",y);
int result=x/y;
return result;
}
}
public class TestE ......
0
Java Web应用在ARM Linux平台上的实现
Posted in 硕博论文 at 十一月 12th, 2009 / No Comments »
王伟,周兰江,刘礼东,解云霄
(昆明理工大学信息工程与自动化学院,云南昆明650051)
1引言
随着网络信息技术的飞速发展,Web技术越来越多的用在控制领域,客户端只需连接以太网,取得访问权限,就可以访 ......