javaÏß³Ì
Ï̵߳Ĵ´½¨ºÍÆô¶¯
JavaÓïÑÔÒѾÄÚÖÃÁ˶àÏß³ÌÖ§³Ö£¬ËùÓÐʵÏÖRunnable½Ó¿ÚµÄÀ඼¿É±»Æô¶¯Ò»¸öÐÂỊ̈߳¬ÐÂÏ̻߳áÖ´ÐиÃʵÀýµÄrun()·½·¨£¬µ±run()·½·¨Ö´ÐÐÍê±Ïºó£¬Ï߳̾ͽáÊøÁË¡£Ò»µ©Ò»¸öÏß³ÌÖ´ÐÐÍê±Ï£¬Õâ¸öʵÀý¾Í²»ÄÜÔÙÖØÐÂÆô¶¯£¬Ö»ÄÜÖØÐÂÉú³ÉÒ»¸öÐÂʵÀý£¬ÔÙÆô¶¯Ò»¸öÐÂÏ̡߳£
ThreadÀàÊÇʵÏÖÁËRunnable½Ó¿ÚµÄÒ»¸öʵÀý£¬Ëü´ú±íÒ»¸öÏ̵߳ÄʵÀý£¬²¢ÇÒ£¬Æô¶¯Ï̵߳ÄΨһ·½·¨¾ÍÊÇͨ¹ýThreadÀàµÄstart()ʵÀý·½·¨£º
Thread t = new Thread();
t.start();
start()·½·¨ÊÇÒ»¸önative·½·¨£¬Ëü½«Æô¶¯Ò»¸öÐÂỊ̈߳¬²¢Ö´ÐÐrun()·½·¨¡£ThreadÀàĬÈϵÄrun()·½·¨Ê²Ã´Ò²²»×ö¾ÍÍ˳öÁË¡£×¢Ò⣺ֱ½Óµ÷ÓÃrun()·½·¨²¢²»»áÆô¶¯Ò»¸öÐÂỊ̈߳¬ËüºÍµ÷ÓÃÒ»¸öÆÕͨµÄjava·½·¨Ã»ÓÐʲôÇø±ð¡£
Òò´Ë£¬ÓÐÁ½¸ö·½·¨¿ÉÒÔʵÏÖ×Ô¼ºµÄỊ̈߳º
·½·¨1£º×Ô¼ºµÄÀàextend Thread£¬²¢¸´Ð´run()·½·¨£¬¾Í¿ÉÒÔÆô¶¯ÐÂÏ̲߳¢Ö´ÐÐ×Ô¼º¶¨ÒåµÄrun()·½·¨¡£ÀýÈ磺
java ´úÂë
public class MyThread extends Thread {
public run() {
System.out.println("MyThread.run()");
}
}
ÔÚºÏÊʵĵط½Æô¶¯Ị̈߳ºnew MyThread().start();
·½·¨2£ºÈç¹û×Ô¼ºµÄÀàÒѾextendsÁíÒ»¸öÀ࣬¾ÍÎÞ·¨Ö±½Óextends Thread£¬´Ëʱ£¬±ØÐëʵÏÖÒ»¸öRunnable½Ó¿Ú£º
java ´úÂë
public class MyThread extends OtherClass implements Runnable {
public run() {
System.out.println("MyThread.run()");
}
}
ΪÁËÆô¶¯MyThread£¬ÐèÒªÊ×ÏÈʵÀý»¯Ò»¸öThread£¬²¢´«Èë×Ô¼ºµÄMyThreadʵÀý£º
java ´úÂë
MyThread myt = new MyThread();
Thread t = new Thread(myt);
t.start();
ÊÂʵÉÏ£¬µ±´«ÈëÒ»¸öRunnable target²ÎÊý¸øThreadºó£¬ThreadµÄrun()·½·¨¾Í»áµ÷ÓÃtarget.run()£¬²Î¿¼JDKÔ´´úÂ룺
java ´úÂë
public void run() {
if (target !=&
Ïà¹ØÎĵµ£º
Android_1.0_eBook_by_tom_kao_2008_10_15.pdf
¡¶AndroidÓ¦Óÿò¼ÜÔÀíÓë³ÌÐòÉè¼Æ36¼¼¡·
±¾書ÍêÕû範例³Ìʽ碼請µ½網Õ¾ÏÂ載:
www.misoo1.com »ò tom-kao.blogspot.com
¸ß煥Ìà Öø(2008 年10 ÔµÚÈý°æ)
misoo.tw@gmail.com
&n ......
windows xpÏÂÅäÖÃJDK»·¾³±äÁ¿£º
1.°²×°JDK£¬°²×°¹ý³ÌÖпÉÒÔ×Ô¶¨Ò尲װĿ¼µÈÐÅÏ¢£¬ÀýÈçÎÒÃÇÑ¡Ôñ°²×°Ä¿Â¼ÎªD:\java\jdk1.5.0_08£»
¡¡ 2.°²×°Íê³Éºó£¬ÓÒ»÷“ÎҵĵçÄÔ”£¬µã»÷“ÊôÐÔ”£»
3.Ñ¡Ôñ“¸ß¼¶”Ñ¡Ï£¬µã»÷“ ......
/*
* @(#)ObjectPoolManager.java 1.00 2005-5-1
*
* Copyright 2005 BeanSoft Studio. All rights reserved.
* PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package  ......
/Download by HTTP
//For other protocol, do it yourself
import java.net.*;
import java.io.*;
public class DonwLoa ......
ÉèÖÃ×¢ÊÍÄ£°åµÄÈë¿Ú£º Window->Preference->Java->Code Style->Code Template È»ºóÕ¹¿ªComments½Úµã¾ÍÊÇËùÓÐÐèÉèÖÃ×¢Ê͵ÄÔªËØÀ²¡£ÏÖ¾Íÿһ¸öÔªËØÖðÒ»½éÉÜ£º
Îļþ(Files)×¢ÊͱêÇ©£º
/**
* @Title: ${file_name}
* @Package ${package_name}
* @Description: ${todo}(ÓÃÒ»¾ä»°ÃèÊö¸ÃÎļ ......