JavaỊ̈߳º´´½¨ÓëÆô¶¯
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() {
for
Ïà¹ØÎĵµ£º
ÔÎĵØÖ·£º http://www.javaworld.com/javaworld/jw-09-2007/jw-09-optimizingregex.html
Èç¹ûÄ㻨·ÑÁËÊýСʱºÍÕýÔò±í´ïʽ×ö¶·Õù£¬Ö»ÊÇΪÁËÈÃËüÍê³ÉËü¼¸ÃëÄھͿÉÒÔÍê³ÉµÄÆ¥Å䣬ÄÇôÕâƪÎÄÕÂÕýÊÇΪÄãÁ¿Éí¶¨×öµÄ¡£Cristian
MocanuÖ¸³öÁËÔÚʲôµØ·½ÕýÔòģʽƥÅä»á·¢ÉúÑÓ³Ù ......
Ãô½Ý¿ª·¢Öбàд¸ßÖÊÁ¿Java´úÂë
2010-03-08 10:32
|
1709
´ÎÔĶÁ
|
¡¾ÒÑÓÐ9
ÌõÆÀÂÛ¡¿·¢±íÆÀÂÛ
À´Ô´£º±ÈÌØÍø À´Ô´£ºIBM/ÍõÓÀ¿ý
|
Êղص½ÎÒµÄÍøÕª
Ãô½Ý¿ª·¢µÄÀíÄîÒѾÁ÷ÐÐÁ˺ܳ¤µÄʱ¼ä£¬ÔÚÃô½Ý¿ª·¢ÖеĿª·¢µü´ú½×¶ÎÖУ¬ÎÒÃÇ¿ÉÒÔͨ¹ýÎå¸ö²½Ö裬À´ÓÐЧµÄÌá¸ßÕû¸öÏîÄ¿µÄ´úÂëÖÊÁ¿¡ ......
ÃæÊÇÎÒÈÏΪÕýÈ·µÄ×ö·¨£¨½áºÏ×Ô¼ºµÄ¾ÑéдµÄ£¬Èç¹û²»ÕýÈ·£¬Çë´ó¼ÒÖ¸Õý£©£º
¡¡¡¡ÎҵĻæͼ¿Ø¼þÊÇJPanel£¬
¡¡¡¡³öÏÖ¹ö¶¯ÌõµÄÇ°Ìᣬ±ØÐëÈûæͼ¿Ø¼þ·ÅÔÚJScrollPaneÉÏ£¬
¡¡¡¡¶ÔÓÚJScrollPaneµÄLayout£¬Ã»ÓÐÌØÊâÒªÇó£¬ÏÂÃæÕâÑù¼´¿É£º
¡¡¡¡view plaincopy to clipboardprint?
¡¡¡¡jScrollPane1.setViewportView(jPanel1);
¡¡ ......
½«´«ÈëµÄÈÎÒâÖÐÎÄ×Ö·ûת»»ÎªÆ´Òô
£¨1£©¶àÒô×ÖֻȡÆäÖÐÒ»¸ö¶ÁÒô¡£
£¨2£©ÉúƧ×ÖÈç¹ûûÓÐÆ´Òô£¬Ê¹ÓÃunknownÌæ´ú¡£
package com.amgotech;
public class ChineseSpelling
{
private static int[] pyvalue = new int[] { -20319, -20317, -20304, -20295, -20292, -20283, -20265, -20257, -20242, -20 ......
ÔÎijö´¦£ºhttp://java.csdn.net/a/20100308/259219.html
Ãô½Ý¿ª·¢µÄÀíÄîÒѾÁ÷ÐÐÁ˺ܳ¤µÄʱ¼ä£¬ÔÚÃô½Ý¿ª·¢ÖеĿª·¢µü´ú½×¶ÎÖУ¬ÎÒÃÇ¿ÉÒÔͨ¹ýÎå¸ö²½Ö裬À´ÓÐЧµÄÌá¸ßÕû¸öÏîÄ¿µÄ´úÂëÖÊÁ¿¡£
JavaÏîÄ¿¿ª·¢¹ý³ÌÖУ¬ÓÉÓÚ¿ª·¢ÈËÔ±µÄ¾Ñé¡¢Java´úÂë±àдϰ¹ß£¬ÒÔ¼°È±·¦Í³Ò»µÄ±ê×¼ºÍ¹ÜÀíÁ÷³Ì£¬ÍùÍùµ¼ÖÂÕû¸öÏîÄ¿µÄ´úÂëÖÊÁ¿½Ï²î£¬ÄÑÓ ......