JavaỊ̈߳ºÏ̵߳ĵ÷¶È ºÏ²¢
JavaỊ̈߳ºÏ̵߳ĵ÷¶È-ºÏ²¢
Ï̵߳ĺϲ¢µÄº¬Òå¾ÍÊǽ«¼¸¸ö²¢ÐÐÏ̵߳ÄÏ̺߳ϲ¢ÎªÒ»¸öµ¥Ïß³ÌÖ´ÐУ¬Ó¦Óó¡¾°Êǵ±Ò»¸öÏ̱߳ØÐëµÈ´ýÁíÒ»¸öÏß³ÌÖ´ÐÐÍê±Ï²ÅÄÜÖ´ÐÐʱ¿ÉÒÔʹÓÃjoin·½·¨¡£
joinΪ·Ç¾²Ì¬·½·¨£¬¶¨ÒåÈçÏ£º
void join()
µÈ´ý¸ÃÏß³ÌÖÕÖ¹¡£
void join(long millis)
µÈ´ý¸ÃÏß³ÌÖÕÖ¹µÄʱ¼ä×Ϊ millis ºÁÃë¡£
void join(long millis, int nanos)
µÈ´ý¸ÃÏß³ÌÖÕÖ¹µÄʱ¼ä×Ϊ millis ºÁÃë + nanos ÄÉÃë¡£
/**
* JavaỊ̈߳ºÏ̵߳ĵ÷¶È-ºÏ²¢
*
* @author leizhimin 2009-11-4 9:02:40
*/
public class Test {
public static void main(String[] args) {
Thread t1 = new MyThread1();
t1.start();
for (int i = 0; i < 20; i++) {
System.out.println("Ö÷Ï̵߳Ú" + i + "´ÎÖ´ÐУ¡");
if (i > 2) try {
//t1Ï̺߳ϲ¢µ½Ö÷Ïß³ÌÖУ¬Ö÷Ïß³ÌÍ£Ö¹Ö´Ðйý³Ì£¬×ª¶øÖ´ÐÐt1Ị̈߳¬Ö±µ½t1Ö´ÐÐÍê±Ïºó¼ÌÐø¡£
t1.j
Ïà¹ØÎĵµ£º
½«´«ÈëµÄÈÎÒâÖÐÎÄ×Ö·ûת»»ÎªÆ´Òô
£¨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 ......
Ãô½Ý¿ª·¢µÄÀíÄîÒѾÁ÷ÐÐÁ˺ܳ¤µÄʱ¼ä£¬ÔÚÃô½Ý¿ª·¢ÖеĿª·¢µü´ú½×¶ÎÖУ¬ÎÒÃÇ¿ÉÒÔͨ¹ýÎå¸ö²½Ö裬À´ÓÐЧµÄÌá¸ßÕû¸öÏîÄ¿µÄ´úÂëÖÊÁ¿¡£
JavaÏîÄ¿¿ª·¢¹ý³ÌÖУ¬ÓÉÓÚ¿ª·¢ÈËÔ±µÄ¾Ñé¡¢Java´úÂë±àдϰ¹ß£¬ÒÔ¼°È±·¦Í³Ò»µÄ±ê×¼ºÍ¹ÜÀíÁ÷³Ì£¬ÍùÍùµ¼ÖÂÕû¸öÏîÄ¿µÄ´úÂëÖÊÁ¿½Ï²î£¬ÄÑÓÚά
»¤£¬ÐèÒª½Ï´óµÄ²âÊÔͶÈëºÍÖÜÆÚµÈÎÊÌâ¡£ÕâЩÎÊÌâÔÚÒ»¸ ......
JavaỊ̈߳º´´½¨ÓëÆô¶¯
SCJP5ѧϰ±Ê¼Ç
Ò»¡¢¶¨ÒåÏß³Ì
1¡¢À©Õ¹java.lang.ThreadÀà¡£
´ËÀàÖÐÓиörun()·½·¨£¬Ó¦¸Ã×¢ÒâÆäÓ÷¨£º
public void run()
Èç¹û¸ÃÏß³ÌÊÇʹÓöÀÁ¢µÄ Runnable ÔËÐжÔÏó¹¹ÔìµÄ£¬Ôòµ÷Óøà Runnable ¶ÔÏóµÄ run ·½·¨£»·ñÔò£¬¸Ã·½·¨²»Ö´ÐÐÈκβÙ×÷²¢·µ»Ø¡£
T ......
JavaỊ̈߳ºÏ̵߳ĵ÷¶È-ÓÅÏȼ¶
ÓëÏß³ÌÐÝÃßÀàËÆ£¬Ï̵߳ÄÓÅÏȼ¶ÈÔÈ»ÎÞ·¨±£ÕÏÏ̵߳ÄÖ´ÐдÎÐò¡£Ö»²»¹ý£¬ÓÅÏȼ¶¸ßµÄÏ̻߳ñÈ¡CPU×ÊÔ´µÄ¸ÅÂʽϴó£¬ÓÅÏȼ¶µÍµÄ²¢·Çû»ú»áÖ´ÐС£
Ï̵߳ÄÓÅÏȼ¶ÓÃ1-10Ö®¼äµÄÕûÊý±íʾ£¬ÊýÖµÔ½´óÓÅÏȼ¶Ô½¸ß£¬Ä¬ÈϵÄÓÅÏȼ¶Îª5¡£
ÔÚÒ»¸öÏß³ÌÖпªÆôÁíÍâÒ»¸öÐÂỊ̈߳¬ÔòпªÏ̳߳ÆÎ ......
JavaỊ̈߳ºÏ̵߳ĵ÷¶È-Èò½
Ï̵߳ÄÈò½º¬Òå¾ÍÊÇʹµ±Ç°ÔËÐÐ×ÅÏß³ÌÈóöCPU×ÊÔ´£¬µ«ÊÇÈ»¸ø˲»ÖªµÀ£¬½ö½öÊÇÈóö£¬Ïß³Ì״̬»Øµ½¿ÉÔËÐÐ״̬¡£
Ï̵߳ÄÈò½Ê¹ÓÃThread.yield()·½·¨£¬yield() Ϊ¾²Ì¬·½·¨£¬¹¦ÄÜÊÇÔÝÍ£µ±Ç°ÕýÔÚÖ´ÐеÄÏ̶߳ÔÏ󣬲¢Ö´ÐÐÆäËûÏ̡߳£
/**
* JavaỊ̈߳ºÏ̵߳ĵ÷¶È-Èò½
*
......