JavaỊ̈߳º´´½¨ÓëÆô¶¯
SCJP5ѧϰ±Ê¼Ç
Ò»¡¢¶¨ÒåÏß³Ì
1¡¢À©Õ¹java.lang.ThreadÀà¡£
´ËÀàÖÐÓиörun()·½·¨£¬Ó¦¸Ã×¢ÒâÆäÓ÷¨£º
public void run
()
Èç¹û¸ÃÏß³ÌÊÇʹÓöÀÁ¢µÄ Runnable
ÔËÐжÔÏó¹¹ÔìµÄ£¬Ôòµ÷Óøà Runnable
¶ÔÏóµÄ run
·½·¨£»·ñÔò£¬¸Ã·½·¨²»Ö´ÐÐÈκβÙ×÷²¢·µ»Ø¡£
Thread
µÄ×ÓÀàÓ¦¸ÃÖØд¸Ã·½·¨¡£
2¡¢ÊµÏÖjava.lang.Runnable½Ó¿Ú¡£
void run
()
ʹÓÃʵÏÖ½Ó¿Ú Runnable
µÄ¶ÔÏó´´½¨Ò»¸öÏß³Ìʱ£¬Æô¶¯¸ÃÏ߳̽«µ¼ÖÂÔÚ¶ÀÁ¢Ö´ÐеÄÏß³ÌÖе÷ÓöÔÏóµÄ run
·½·¨¡£
·½·¨ run
µÄ³£¹æж¨ÊÇ£¬Ëü¿ÉÄÜÖ´ÐÐÈκÎËùÐèµÄ²Ù×÷¡£
¶þ¡¢ÊµÀý»¯Ïß³Ì
1¡¢Èç¹ûÊÇÀ©Õ¹java.lang.ThreadÀàµÄỊ̈߳¬ÔòÖ±½Ónew¼´¿É¡£
2¡¢Èç¹ûÊÇʵÏÖÁËjava.lang.Runnable½Ó¿ÚµÄÀ࣬ÔòÓÃThreadµÄ¹¹Ôì·½·¨£º
Thread(Runnable target)
Thread(Runnable target, String name)
Thread(ThreadGroup group, Runnable target)
Thread(ThreadGroup group, Runnable target, String name)
Thread(ThreadGroup group, Runnable target, String name, long stackSize)
Èý¡¢Æô¶¯Ïß³Ì
ÔÚÏ̵߳ÄThread¶ÔÏóÉϵ÷ÓÃstart()·½·¨£¬¶ø²»ÊÇrun()»òÕß±ðµÄ·½·¨¡£
ÔÚµ÷ÓÃstart()·½·¨Ö®Ç°£ºÏ̴߳¦ÓÚÐÂ״̬ÖУ¬ÐÂ״ָ̬ÓÐÒ»¸öThread¶ÔÏ󣬵«»¹Ã»ÓÐÒ»¸öÕæÕýµÄÏ̡߳£
ÔÚµ÷ÓÃstart()·½·¨Ö®ºó£º·¢ÉúÁËһϵÁи´ÔÓµÄÊÂÇé
Æô¶¯ÐµÄÖ´ÐÐỊ̈߳¨¾ßÓÐеĵ÷ÓÃÕ»£©£»
¸ÃÏ̴߳ÓÐÂ״̬תÒƵ½¿ÉÔËÐÐ״̬£»
µ±¸ÃÏ̻߳ñµÃ»ú»áÖ´ÐÐʱ£¬ÆäÄ¿±êrun()·½·¨½«ÔËÐС£
×¢Ò⣺¶ÔJavaÀ´Ëµ£¬run()·½·¨Ã»ÓÐÈκÎÌرðÖ®´¦¡£Ïñmain()·½·¨Ò»Ñù£¬ËüÖ»ÊÇÐÂÏß³ÌÖªµÀµ÷Óõķ½·¨Ãû³Æ(ºÍÇ©Ãû)¡£Òò´Ë£¬ÔÚRunnableÉÏ»òÕßThreadÉϵ÷ÓÃrun·½·¨ÊǺϷ¨µÄ¡£µ«²¢²»Æô¶¯ÐµÄÏ̡߳£
ËÄ¡¢Àý×Ó
1¡¢ÊµÏÖRunnable½Ó¿ÚµÄ¶àÏß³ÌÀý×Ó
/**
* ʵÏÖRunnable½Ó¿ÚµÄÀà
*
* @author leizhimin 2008-9-13 18:12:10
*/
public
class
DoSomething implements
Runnable {
private
String name;
public
DoSomething(String name) {
this
.name = name;
}
public
void
run() {
&nb
Ïà¹ØÎĵµ£º
Devoxx ´ó»á½áÊøÔÚ¼¸ÌìÇ°½áÊøÁË£¬Ò»Î»Óë»áÕ߶Դ˴δó»áµÄÖØÒªÄÚÈݽøÐÐÁË×ܽᣬËûÌáµ½Java 7µÄÖ÷Òª±ä»¯ÈçÏ£º
1.¶ÔcollectionsµÄÖ§³Ö
Java´úÂë
List<String> list = new ArrayList<String>();
list.add(“item”);
String item =&nbs ......
ÈçºÎ¶ÁÈ¡×ÊÔ´Îļþ£º
£¨Ò»£©
Properties props = new Properties();
props.load(new FileInputStream("db.properties"));
£¨¶þ£©
blog.propertiesÎļþÈçÏÂ
dbdriver=oracle.jdbc.driver.OracleDriver
dburl=jdbc:oracle:thin:@127.0.0.1:1521:ora92
dbuser=blog
dbpwd=blog
- ......
ÔÚÒ»¸öÃæÏò¶ÔÏóµÄϵͳÖУ¬ÏµÍ³µÄ¸÷ÖÖ¹¦ÄÜÊÇÓÉÐíÐí¶à¶àµÄ²»Í¬¶ÔÏóÐ×÷Íê³ÉµÄ¡£ÔÚÕâÖÖÇé¿öÏ£¬¸÷¸ö¶ÔÏóÄÚ²¿ÊÇÈçºÎʵÏÖ×Ô¼ºµÄ¶ÔϵͳÉè¼ÆÈËÔ±À´½²¾Í²»ÄÇôÖØÒª
ÁË£»¶ø¸÷¸ö¶ÔÏóÖ®¼äµÄÐ×÷¹ØϵÔò³ÉΪϵͳÉè¼ÆµÄ¹Ø¼ü¡£Ð¡µ½²»Í¬ÀàÖ®¼äµÄͨÐÅ£¬´óµ½¸÷Ä£¿éÖ®¼äµÄ½»»¥£¬ÔÚϵͳÉè¼ÆÖ®³õ¶¼ÊÇÒª×ÅÖØ¿¼Âǵģ¬ÕâÒ²ÊÇϵͳÉè¼ÆµÄÖ÷
Òª ......
ʹÓÃJAVA¿ª·¢ÏµÍ³ÍÐÅ̳ÌÐò
@for&ever 2009-11-27
²Î¿¼ÎÄÕ¡¶New System Tray Functionality in Java SE 6¡·£¬ÍøÖ· http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/systemtray/ ¡£
JDK±ØÐëÒªÔÚ 1.6 °æ±¾¡£
×î½üÏîÄ¿ÖÐҪʵÏÖ¶¨Ê±ÈÎÎñ³£×¤ÏµÍ³£¬Äܹ»Í¬Ê±ÓÐÒ»¸ö±È½ÏÓѺõIJÙ×÷·½Ê½Ìṩ¸ø ......
SCJP5ѧϰ±Ê¼Ç
Ò»¡¢²Ù×÷ϵͳÖÐÏ̺߳ͽø³ÌµÄ¸ÅÄî
ÏÖÔڵIJÙ×÷ϵͳÊǶàÈÎÎñ²Ù×÷ϵͳ¡£¶àÏß³ÌÊÇʵÏÖ¶àÈÎÎñµÄÒ»ÖÖ·½Ê½¡£
½ø³ÌÊÇÖ¸Ò»¸öÄÚ´æÖÐÔËÐеÄÓ¦ÓóÌÐò£¬Ã¿¸ö½ø³Ì¶¼ÓÐ×Ô¼º¶ÀÁ¢µÄÒ»¿éÄÚ´æ¿Õ¼ä£¬Ò»¸ö½ø³ÌÖпÉÒÔÆô¶¯¶à¸öÏ̡߳£±ÈÈçÔÚWindowsϵͳÖУ¬Ò»¸öÔËÐеÄexe¾ÍÊÇÒ»¸ö½ø³Ì¡£
Ïß³ÌÊÇÖ¸½ø³ÌÖеÄÒ ......