Java¶àÏß³Ì
¶àÏß³Ì
Ị̈߳ºÊÇÖ¸½ø³ÌÖеÄÒ»¸öÖ´ÐÐÁ÷³Ì¡£
Ïß³ÌÓë½ø³ÌµÄÇø±ð£ºÃ¿¸ö½ø³Ì¶¼ÐèÒª²Ù×÷ϵͳΪÆä·ÖÅä¶ÀÁ¢µÄÄÚ´æµØÖ·¿Õ¼ä£¬¶øͬһ½ø³ÌÖеÄËùÓÐÏß³ÌÔÚͬһ¿éµØÖ·¿Õ¼äÖй¤×÷£¬ÕâЩÏ߳̿ÉÒÔ¹²Ïíͬһ¿éÄÚ´æºÍϵͳ×ÊÔ´¡£
ÈçºÎ´´½¨Ò»¸öỊ̈߳¿
´´½¨Ïß³ÌÓÐÁ½ÖÖ·½Ê½£¬ÈçÏ£º
1¡¢ À©Õ¹java.lang.ThreadÀà
2¡¢ ʵÏÖRunnable½Ó¿Ú
ThreadÀà´ú±íÏß³ÌÀ࣬ËüµÄÁ½¸ö×îÖ÷ÒªµÄ·½·¨ÊÇ£º
run()——°üº¬Ïß³ÌÔËÐÐʱËùÖ´ÐеĴúÂë
Start()——ÓÃÓÚÆô¶¯Ïß³Ì
Ò»¸öÏß³ÌÖ»Äܱ»Æô¶¯Ò»´Î¡£µÚ¶þ´ÎÆô¶¯Ê±½«»áÅ׳öjava.lang.IllegalThreadExcetpionÒì³£
Ï̼߳ä״̬µÄת»»£¨Èçͼʾ£©
н¨×´Ì¬£ºÓÃnewÓï¾ä´´½¨µÄÏ̶߳ÔÏó´¦ÓÚн¨×´Ì¬£¬´ËʱËüºÍÆäËüµÄjava¶ÔÏóÒ»Ñù£¬½ö½öÔÚ¶ÑÖб»·ÖÅäÁËÄÚ´æ
¾ÍÐ÷״̬£ºµ±Ò»¸öÏ̴߳´½¨ÁËÒÔºó£¬ÆäËûµÄÏ̵߳÷ÓÃÁËËüµÄstart()·½·¨£¬¸ÃÏ߳̾ͽøÈëÁ˾ÍÐ÷״̬¡£´¦ÓÚÕâ¸ö״̬µÄÏß³ÌλÓÚ¿ÉÔËÐгØÖУ¬µÈ´ý»ñµÃCPUµÄʹÓÃȨ
ÔËÐÐ״̬£º´¦ÓÚÕâ¸ö״̬µÄÏß³ÌÕ¼ÓÃCPU,Ö´ÐгÌÐòµÄ´úÂë
×èÈû״̬£ºµ±Ï̴߳¦ÓÚ×èÈû״̬ʱ£¬javaÐéÄâ»ú²»»á¸øÏ̷߳ÖÅäCPU£¬Ö±µ½Ïß³ÌÖØнøÈë¾ÍÐ÷״̬£¬Ëü²ÅÓлú»áתµ½ÔËÐÐ״̬¡£
×èÈû״̬·ÖΪÈýÖÖÇé¿ö£º
1¡¢ λÓÚ¶ÔÏóµÈ´ý³ØÖеÄ×èÈû״̬£ºµ±Ïß³ÌÔËÐÐʱ£¬Èç¹ûÖ´ÐÐÁËij¸ö¶ÔÏóµÄwait()·½·¨£¬javaÐéÄâ»ú¾Í»Ø°ÑÏ̷߳ŵ½Õâ¸ö¶ÔÏóµÄµÈ´ý³ØÖÐ
2¡¢ λÓÚ¶ÔÏóËøÖеÄ×èÈû״̬£¬µ±Ï̴߳¦ÓÚÔËÐÐ״̬ʱ£¬ÊÔͼ»ñµÃij¸ö¶ÔÏóµÄͬ²½Ëøʱ£¬Èç¹û¸Ã¶ÔÏóµÄͬ²½ËøÒѾ±»ÆäËûµÄÏß³ÌÕ¼Óã¬JVM¾Í»á°ÑÕâ¸öÏ̷߳ŵ½Õâ¸ö¶ÔÏóµÄËö³ØÖС£
3¡¢ ÆäËüµÄ×èÈû״̬£ºµ±Ç°Ïß³ÌÖ´ÐÐÁËsleep()·½·¨£¬»òÕßµ÷ÓÃÁËÆäËüÏ̵߳Äjoin()·½·¨£¬»òÕß·¢³öÁËI/OÇëÇóʱ£¬¾Í»á½øÈëÕâ¸ö״̬ÖС£
ËÀÍö״̬£ºµ±Ïß³ÌÍ˳öÁËrun()·½·¨£¬¾Í½øÈëÁËËÀÍö״̬£¬¸ÃÏ߳̽áÊøÁËÉúÃüÖÜÆÚ¡£
»òÕßÕý³£Í˳ö
»òÕßÓöµ½Òì³£Í˳ö
ThreadÀàµÄisAlive()·½·¨ÅжÏÒ»¸öÏß³ÌÊÇ·ñ»î×Å£¬µ±Ï̴߳¦ÓÚËÀÍö״̬»òÕßн¨×´Ì¬Ê±£¬¸Ã·½·¨·µ»Øfalse,ÔÚÆäÓàµÄ״̬Ï£¬¸Ã·½·¨·µ»Øtrue.
Ï̵߳÷¶È
Ï̵߳÷¶ÈÄ£ÐÍ£º·Öʱµ÷¶ÈÄ£ÐͺÍÇÀռʽµ÷¶ÈÄ£ÐÍ
JVM²ÉÓÃÇÀռʽµ÷¶ÈÄ£ÐÍ¡£
ËùνµÄ¶àÏ̵߳IJ¢·¢ÔËÐУ¬ÆäʵÊÇÖ¸ºê¹ÛÉÏ¿´£¬¸÷¸öÏß³ÌÂÖÁ÷»ñµÃCPUµÄʹÓÃȨ£¬·Ö±ðÖ´Ðи÷×ÔµÄÈÎÎñ¡£
£¨Ï̵߳ĵ÷¶È²»Ê
Ïà¹ØÎĵµ£º
package cn.test;
import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
/**
* Java Reflection Cookbook
*
* @author Michael Lee
* @since 2006-8-23
* ......
×Ô java ƽ̨´Ó 1995 Äê×÷Ϊһ¸öÕûÌåÒýÈë±à³ÌÉçÇø¿ªÊ¼£¬ËüµÄ·¢Õ¹ÒѾԶԶ³¬³öÁËÔçÆÚ java ר¼ÒºÍÍƽéÕßËùÉèÏëµÄ“applet ÎÞ´¦²»ÔÚ”ÕâÒ»Ô¶¾°¡£Ïà·´£¬java ÊÀ½ç³öÏÖÁË Swing¡¢Óë servlet ½áºÏ£¬´Ó¶ø·¢Õ¹Îª J2EE¡¢³öÏÖÁË EJB¡¢³¬Ô½ÁË Spring ºÍ Hibernate¡¢Ìí¼ÓÁË·ºÐÍ£¬±äµÃÔ½À´Ô½¾ßÓж¯Ì¬ÐÔ£¬È»ºóʵÏÖÁ˺¯Êý»¯£¬ÔÚ ......
2009Äê7ÔÂÎҲμÓÁËÒ»¸öJAVAרҵ»ú¹¹µÄÅàѵ£¬Ö®ËùÒԲμÓÕâ¸öÅàѵ£¬ÎÒÊÇΪÁ˽øÒ»²½ÌáÉý×Ô¼ºµÄ¼¼Êõ£¬ÁíÒ»·½ÃæÎÒÒ²±È½Ïϲ»¶JAVA£¬Ï£ÍûËüÄܳÆΪÎҵļ¼ÊõÖ÷Á¦¡£×ªÑÛ£¬Åàѵ¾Í¿ì½áÊøÁË£¬ÐÄÖиÐÎòÁ¼¶à£¬Ï£ÍûÓë¾ý¹²Ãã¡£
ÎÒËù²Î¼ÓµÄÅàѵ»ú¹¹Ö»ÓÐÒ»¸öÀÏʦ£¬²»ÏñºÜ¶àµØ·½ÓкöàµÄÀÏʦ£¬Ã¿Ììÿһ½Ú¿Î¶¼ÊÇËûÀ´¸ ......
Java EE 6ÏÖÔÚÒѾÕýʽ·¢²¼¡£ÔÚSunµÄ¹Ù·½ÍøÕ¾ÉÏ£¬ÓÐһϵÁÐÎÄÕ¶ÔJava EE 6µÄ¼¼Êõ±ê×¼½øÐÐÁËÏêϸµÄ½éÉÜ¡£½ñÌìÕâƪ½éÉÜJava EE 6µÄÖ÷ҪĿ±ê¡£
Javaƽ̨ÆóÒµ°æ±¾(Java EE)Êǹ¹½¨JavaÆóÒµ¼¶Ó¦ÓÃϵͳµÄÐÐÒµ±ê×¼£¬ËüÒÔ¼áʵµÄJavaƽ̨±ê×¼°æ(Java SE)Ϊ»ù´¡£¬Ìí¼ÓÁËÖ§³Ö¿ÉÀ©Õ¹ÐÔ¡¢¿É·ÃÎÊÐÔ¡¢°²È«ÐÔ¡¢ÍêÕûÐÔºÍÆäËüÆóÒµ¼¶Ó¦ÓÃÐèÒªµÄ ......
==²Ù×÷·ûÓëequals·½·¨µÄÇø±ð£º
==ÊÇÒýÓÃÀàÐͱȽÏÒýÓÃ(Ò²¾ÍÊDZȽÏÄÚÈݺ͵ØÖ·)£»»ù±¾ÀàÐͱȽÏÖµ£»
equals()·½·¨Ö»ÄܱȽÏÒýÓÃÀàÐÍ£¬"=="¿ÉÒԱȽÏÒýÓÃÀàÐͼ°»ù±¾ÀàÐÍ£»
ÌØÀý£ºµ±ÓÃequals()·½·¨½øÐбȽÏʱ£¬¶ÔÀàFile¡¢String¡¢Date¼°·â×°ÀࣨWrapper°ü×° ......