最终幻想零式林泽:有谁能帮我用Jbuilder编一个application的小程序?急用,谢谢!

来源:百度文库 编辑:高校问答 时间:2024/04/29 09:18:42
这学期选修课选的java,结果没几节课是去的,期末要交一个application的小程序,能不能帮我编一个发在我邮箱里,地址是jesse_zjx@126.com
万分感谢!

/**
*
*/

/**
* @author Administrator
*
*/
public class Run {

/**
*
*/
public Run() {
super();
// TODO Auto-generated constructor stub
}

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int threadMember = 10;
if (args.length > 0)
threadMember = new Integer(args[0]).intValue();
System.out.print("共有 " + threadMember + " 个线程!\r\n");
for (int i = 0; i < threadMember; i++) {
ThreadManage threadManage = new ThreadManage(i);
Thread spiderThread = new Thread(threadManage);
spiderThread.setPriority(Thread.MAX_PRIORITY);
spiderThread.start();
}

}

}

public class ThreadManage implements Runnable {

String threadName="线程编号:";
Spider spider=new Spider();

public ThreadManage(int no) {
super();
// TODO Auto-generated constructor stub
threadName+=no;
}

public void run() {
// TODO Auto-generated method stub
while (true) {
try {
long start = System.currentTimeMillis();
//
spider.execute();
//
System.out.println(threadName+" Running Time: " +
(System.currentTimeMillis() - start) + " ms\r\n");
Thread.sleep(1000);
}
catch (Exception e) {
e.printStackTrace();
}
}

}

}