Java SEÖеÄÏß³Ì
1.´´½¨Ïß³Ì
·½Ê½Ò»£ºÍ¨¹ýThreadµÄ×ÓÀà´´½¨£¬´ËʱÐèÒªÔÚThreadÀàµÄ×ÓÀàÖÐÖØд¸¸ÀàµÄpublic void run()·½·¨
·½Ê½¶þ£ºÖ±½ÓʹÓÃThreadÀà´´½¨
ÓÃÕâÖÖ·½Ê½´´½¨Ïß³Ìʱ£¬Í¨³£ÒªÊ¹ÓÃÒÔϹ¹Ôì·½·¨£ºThread(Runnable a) //RunnableÊÇÒ»¸ö½è¿Ú
´ËʱÐèÒªÔÚʹÓÃÁËRunnable½Ó¿ÚµÄÀàÖÐÖØдThreadÀàµÄpublic void run()·½·¨
2.ThreadÀà³£Óõķ½·¨
start()£ºÆô¶¯Ị̈߳¬Ò»°ãÊÇÔÚÖ÷º¯ÊýÖÐÆô¶¯
run()£ºÓÃÀ´¹æ¶¨Ï̱߳»Æô¶¯ÒԺ󣬸ÃÏß³ÌËùÒªÖ´ÐеľßÌå²Ù×÷
setName(String s)£º¸øÏß³ÌÈ¡Ãû
getName()£º·µ»Øµ±Ç°Ï̵߳ÄÃû³Æ
sleep(int millsecond)£ºÊÇThreadÀàµÄÀà·½·¨£¬¸Ã·½·¨ÊÇÏß³ÌÔÚÆärun()·½·¨Öо³£µ÷Óõķ½·¨£¬±íʾÏß³ÌÐÝÃßÒ»¶Îʱ¼ä£¬
millsecondÊÇÆäÐÝÃߵĺÁÃëÊý£»Ëü±ØÐëÔÚtry--catchÓï¾äÖб»µ÷Óã¬Òì³£Ààͨ³£ÎªInterruptedException
isAlive()£ºÅжϸÃÏß³ÌÊÇ·ñ´¦ÓÚÔËÐÐ״̬
currentThread()£º·µ»Øµ±Ç°ÕýÔÚÕ¼ÓÃCPU×ÊÔ´µÄÏß³Ì
interrupt()£ºµ±Ä³¸öÏ̵߳÷ÓÃsleep()·½·¨´¦ÓÚÐÝÃß״̬ʱ£¬¸ÃÏ߳̿ÉÒÔʹÓÃinterrupted()·½·¨³³ÐÑ×Ô¼º£¬¼´µ¼ÖÂÐÝÃßµÄÏ̷߳¢Éú
InterruptedExceptionÒì³££¬´Ó¶ø½áÊøÐÝÃߣ¬ÖØÐÂÅŶӵȴýCUP×ÊÔ´
3.Ïß³Ìͬ²½
ÊÇÖ¸Èô¸É¸öÏß³ÌÐèҪʹÓÃͬһ¸ösynchronizedÐÞÊεķ½·¨
ÓÃsynchronizedÐÞÊεķ½·¨³ÆΪͬ²½·½·¨
Ïà¹ØÎĵµ£º
http://lavasoft.blog.51cto.com/62575/18920
JavaÒì³£´¦Àí×ܽá
Òì³£´¦ÀíÊdzÌÐòÉè¼ÆÖÐÒ»¸ö·Ç³£ÖØÒªµÄ·½Ã棬ҲÊdzÌÐòÉè¼ÆµÄÒ»´óÄѵ㣬´ÓC¿ªÊ¼£¬ÄãÒ²ÐíÒѾ֪µÀÈçºÎÓÃif...else...À´¿ØÖÆÒì³£ÁË£¬Ò²ÐíÊÇ×Ô·¢
µÄ£¬È»¶øÕâÖÖ¿ØÖÆÒ쳣ʹ¿à£¬Í¬Ò»¸öÒì³£»òÕß´íÎóÈç¹û¶à¸öµØ· ......
ÏÂÃæÒÔ±àÒë /src/com/dream/io/ScannerTest.javaΪʾÀý£º
1¡¢ÓÃjavac±àÒë.javaÎļþʱ£¬½øÈësrcĿ¼ºó£¬ÊäÈë javac com/dream/io/ScannerTest.java£¬ »Ø³µ£¬¼´¿É±àÒëScannerTest.javaÎļþΪ.classÎļþ£»Ò²¿É£¬½øÈë /src/com/dream/io/ Ŀ¼ºó£¬ ÊäÈë javac ScannerTest.java£¬ »Ø³µ£¬Ò²¿É±àÒë ScannerTest.javaÎļþΪ .clas ......
ʹÓÃJ2SE API¶ÁÈ¡PropertiesÎļþµÄÁùÖÖ·½·¨
1¡£Ê¹ÓÃjava.util.PropertiesÀàµÄload()·½·¨
ʾÀý£º InputStream in = lnew BufferedInputStream(new FileInputStream(name));
Properties p = new Properties();
p.load(in);
2¡£Ê¹ÓÃjava.util.ResourceBundleÀàµÄgetBundle()·½·¨
ʾÀý£º ResourceBundle rb = Resou ......
ÎÒ½ñÌìѧϰÁËluceneµÄһЩ֪ʶ£¬ÎÒ×öÁ˼òµ¥µÄ±Ê¼Ç£º
Ë÷ÒýÎļþ½á¹¹£º
µ¹ÅÅË÷Òý£¬Ë÷Òý¶ÔÏóÊÇÎĵµÖеĵ¥´ÊµÈ£¬ÓÃÀ´´æ´¢ÕâЩµ¥´ÊÔÚÒ»¸öÎĵµÖеÄλÖá£ÀýÈ磬ÓÐЩÊéÔÚ×îºóÌṩµÄË÷Òý£¨µ¥´Ê——Ò³ÂëµÄ¶ÔÓ¦ÁÐ±í£©£¬¾Í¿ÉÒÔ¿´³ÉÊÇÒ»ÖÖµ¹ÅÅÐòË÷Òý¡£¿ÉÒÔͨ¹ýһЩ¹Ø¼ü×Ö£¬ÔÚÈ«ÊéÖмìË÷³öÓëÖ®Ïà¹ØµÄ²¿
Ë÷ÒýÎ ......