JavaÏß³Ì֪ʶÉîÈë½âÎö(1)
Ò»°ãÀ´Ëµ,ÎÒÃÇ°ÑÕýÔÚ¼ÆËã»úÖÐÖ´ÐеijÌÐò½Ð×ö"½ø³Ì"(Process) ,¶ø²»½«Æä³ÆΪ³ÌÐò(Program)¡£Ëùν"Ïß³Ì"(Thread),ÊÇ"½ø³Ì"ÖÐij¸öµ¥Ò»Ë³ÐòµÄ¿ØÖÆÁ÷¡£ÐÂÐ˵IJÙ×÷ϵͳ,ÈçMac,Windows NT,Windows 95µÈ,´ó¶à²ÉÓöàÏ̵߳ĸÅÄî,°ÑÏß ³ÌÊÓΪ»ù±¾Ö´Ðе¥Î»¡£Ïß³ÌÒ²ÊÇJavaÖеÄÏ൱ÖØÒªµÄ×é³É²¿·ÖÖ®Ò»¡£
ÉõÖÁ×î¼òµ¥µÄAppletÒ²ÊÇÓɶà¸öÏß³ÌÀ´Íê³ÉµÄ¡£ÔÚJavaÖÐ,ÈκÎÒ»¸öAppletµÄpaint()ºÍupdate()·½·¨¶¼ÊÇÓÉAWT(Abstract Window Toolkit)»æͼÓëʼþ´¦ÀíÏ̵߳÷ÓõÄ,¶øApplet Ö÷ÒªµÄÀï³Ì±®·½·¨——init(),start(),stop()ºÍdestory() ——ÊÇÓÉÖ´ÐиÃAppletµÄÓ¦Óõ÷Óõġ£
µ¥Ï̵߳ĸÅÄîûÓÐʲôеĵط½,ÕæÕýÓÐȤµÄÊÇÔÚÒ»¸ö³ÌÐòÖÐͬʱʹÓöà¸öÏß³ÌÀ´Íê³É²»Í¬µÄÈÎÎñ¡£Ä³Ð©µØ·½ÓÃÇáÁ¿½ø³Ì(Lightweig ht Process)À´´úÌæÏß³Ì,Ïß³ÌÓëÕæÕý½ø³ÌµÄÏàËÆÐÔÔÚÓÚËüÃǶ¼Êǵ¥Ò»Ë³Ðò¿ØÖÆÁ÷¡£È»¶øÏ̱߳»ÈÏΪÇáÁ¿ÊÇÓÉÓÚËüÔËÐÐÓÚÕû¸ö³ÌÐòµÄÉÏÏÂÎÄÄÚ,ÄÜʹÓÃÕû¸ö³ÌÐò¹²ÓеÄ×ÊÔ´ºÍ³ÌÐò»·¾³¡£
×÷Ϊµ¥Ò»Ë³Ðò¿ØÖÆÁ÷,ÔÚÔËÐеijÌÐòÄÚÏ̱߳ØÐëÓµÓÐһЩ×ÊÔ´×÷Ϊ±ØÒªµÄ¿ªÏú¡£ÀýÈç,±ØÐëÓÐÖ´ÐжÑÕ»ºÍ³ÌÐò¼ÆÊýÆ÷ÔÚÏß³ÌÄÚÖ´ÐеĴúÂëÖ»ÔÚËüµÄÉÏÏÂÎÄÖÐÆð×÷ÓÃ,Òò´ËijЩµØ·½ÓÃ"Ö´ÐÐÉÏÏÂÎÄ"À´´úÌæ"Ïß³Ì"¡£
Ïß³ÌÊôÐÔ
ΪÁËÕýÈ·ÓÐЧµØʹÓÃÏß³Ì,±ØÐëÀí½âÏ̵߳ĸ÷¸ö·½Ãæ²¢Á˽âJava ʵʱϵͳ¡£±ØÐëÖªµÀÈçºÎÌṩÏß³ÌÌå¡¢Ï̵߳ÄÉúÃüÖÜÆÚ¡¢ÊµÊ±ÏµÍ³ÈçºÎµ÷¶ÈÏ̡߳¢Ïß³Ì×顢ʲôÊÇÓÄÁéÏß³Ì(Demo nThread)¡£
(1)Ïß³ÌÌå
ËùÓеIJÙ×÷¶¼·¢ÉúÔÚÏß³ÌÌåÖÐ,ÔÚJavaÖÐÏß³ÌÌåÊÇ´ÓThreadÀà¼Ì³ÐµÄrun()·½·¨,»òʵÏÖRunnable½Ó¿ÚµÄÀàÖеÄrun()·½·¨¡£µ±Ï̲߳úÉú²¢³õʼ»¯ºó,ʵʱϵͳµ÷ÓÃËüµÄrun()·½·¨¡£run()·½·¨ÄڵĴúÂëʵÏÖËù²úÉúÏ̵߳ÄÐÐΪ,ËüÊÇÏ̵߳ÄÖ÷Òª²¿
·Ö¡£
(2)Ïß³Ì״̬
¸½Í¼±íʾÁËÏß³ÌÔÚËüµÄÉúÃüÖÜÆÚÄÚµÄÈκÎʱ¿ÌËùÄÜ´¦µÄ״̬ÒÔ¼°ÒýÆð״̬¸Ä±äµÄ·½·¨¡£Õâͼ²¢²»ÊÇÍêÕûµÄÓÐÏÞ״̬ͼ,µ«»ù±¾¸ÅÀ¨ÁËÏß³ÌÖбȽϸÐÐËȤºÍÆÕ±éµÄ·½Ãæ¡£ÒÔÏÂÌÖÂÛÓйØÏß³ÌÉúÃüÖÜÆÚÒÔ´ËΪ¾Ý¡£
¡ñÐÂÏß³Ì̬(New Thread)
²úÉúÒ»¸öThread¶ÔÏó¾ÍÉú³ÉÒ»¸öÐÂÏ̡߳£µ±Ï̴߳¦ÓÚ"ÐÂÏß³Ì"״̬ʱ,½ö½öÊÇÒ»¸ö¿ÕÏ̶߳ÔÏó,Ëü»¹Ã»ÓзÖÅ䵽ϵͳ×ÊÔ´¡£Òò´ËÖ»ÄÜÆô¶¯»òÖÕÖ¹Ëü¡£ÈκÎÆäËû²Ù×÷¶¼»áÒý·¢Òì³£¡£
¡ñ¿ÉÔËÐÐ̬(Runnable)
start()·½·¨²úÉúÔËÐÐÏß³ÌËù±ØÐëµÄ×ÊÔ´,µ÷¶ÈÏß³ÌÖ´ÐÐ,²¢ÇÒµ÷ÓÃÏ̵߳Ärun ()·½·¨¡£ÔÚÕâʱÏ̴߳¦ÓÚ¿ÉÔËÐÐ̬¡£¸Ã״̬²»³ÆΪÔËÐÐ̬ÊÇÒòΪÕâʱµÄÏ̲߳¢²»×ÜÊÇÒ»Ö±Õ¼Óô¦Àí»ú¡£ÌرðÊǶÔÓÚÖ»ÓÐÒ»¸ö´¦Àí»úµÄPC¶øÑÔ,Èκ
Ïà¹ØÎĵµ£º
1£®Hibernate¹¤×÷ÔÀí¼°ÎªÊ²Ã´ÒªÓã¿
ÔÀí£º
1.¶ÁÈ¡²¢½âÎöÅäÖÃÎļþ
2.¶ÁÈ¡²¢½âÎöÓ³ÉäÐÅÏ¢£¬´´½¨SessionFactory
3.´ò¿ªSesssion
4.´´½¨ÊÂÎñTransation
5.³Ö¾Ã»¯²Ù×÷
6.Ìá½»ÊÂÎñ
7.¹Ø±ÕSession
8.¹Ø±ÕSesstionFactory
ΪʲôҪÓãº
1. ¶ÔJDB ......
ÏÈÌùÒ»¶Î
Java
»ù±¾½á¹¹
Java
½á¹¹°üÀ¨Ëĸö²»Í¬¶øÓÖÏà¹ØµÄ²¿·Ö£º
Java
ÓïÑÔ¡¢
class
Îļþ¸ñʽ¡¢Ó¦ÓóÌÐò½Ó
¿Ú¡¢ÐéÄâ»ú
ÆäÖУ¬ÐéÄâ»úµÄÖ÷ÒªÈÎÎñÊÇÔÚ³ÌÐòÔËÐÐÖÐÐèÒªµÄʱºòµ÷ÓÃ
class
Îļþ²¢Ö´ÐÐÆäÖеÄ×Ö½ÚÂë¡£Ò»¸ö
Java
Ó¦
ÓÃÓÐÁ½ÖÖ
class loader
£º
the system class loader
ºÍ
class loader objects
......
import java.util.*;
import java.util.regex.Pattern;
public class StrTools {
/**
* ·Ö¸î×Ö·û´®
*
* @param str String Ôʼ×Ö·û´®
* @param splitsign String ·Ö¸ô·û
* @return String[] ·Ö¸îºóµÄ×Ö·û´®Êý×é
*/
@SuppressWarnings("unchecked")
public static String[] split(Stri ......
×Ö·û´®
1¡¢»ñÈ¡×Ö·û´®µÄ³¤¶È
length()
2 ¡¢ÅжÏ×Ö·û´®µÄǰ׺»òºó׺ÓëÒÑÖª×Ö·û´®ÊÇ·ñÏàͬ
ǰ׺ startsWith(String s)
ºó׺ endsWith(String s)
3¡¢±È½ÏÁ½¸ö×Ö·û´®
equals(String s)
4¡¢°Ñ×Ö·û´®×ª»¯ÎªÏàÓ¦µÄÊýÖµ
intÐÍ Integer.parseInt(×Ö·û´®)
......
Ò» Ï̵߳Ļù±¾¸ÅÄî
Ïß³ÌÊÇÒ»¸ö³ÌÐòÄÚ²¿µÄ˳Ðò¿ØÖÆÁ÷.Ò»¸ö½ø³ÌÏ൱ÓÚÒ»¸öÈÎÎñ,Ò»¸öÏß³ÌÏ൱ÓÚÒ»¸öÈÎÎñÖеÄÒ»ÌõÖ´Ðз¾¶.£»¶à½ø³Ì:ÔÚ²Ù×÷ϵͳÖÐÄÜͬʱÔËÐжà¸öÈÎÎñ(³ÌÐò)£»¶àÏß³Ì:ÔÚͬһ¸öÓ¦ÓóÌÐòÖÐÓжà¸ö˳ÐòÁ÷ͬʱִÐУ»JavaµÄÏß³ÌÊÇͨ¹ýjava.lang.ThreadÀàÀ´ÊµÏֵģ»JVMÆô¶¯Ê±»áÓÐÒ»¸öÓÉÖ÷·½·¨(public static void main( ......