Java¶àÏß³Ì
http://lavasoft.blog.51cto.com/62575/27069
ÊØ»¤Ï̺߳ÍÓû§Ïß³Ì
ÊØ»¤Ïß³ÌÓëÆÕͨÏ̵߳ÄΨһÇø±ðÊÇ£ºµ±JVMÖÐËùÓеÄÏ̶߳¼ÊÇÊØ»¤Ï̵߳Äʱºò£¬JVM¾Í¿ÉÒÔÍ˳öÁË£»Èç¹û»¹ÓÐÒ»¸ö»òÒÔÉϵķÇÊØ»¤Ïß³ÌÔò²»»áÍ˳ö¡££¨ÒÔÉÏÊÇÕë¶ÔÕý³£Í˳ö£¬µ÷ÓÃSystem.exitÔò±Ø¶¨»áÍ˳ö£©
ËùÒÔsetDeamon(true)µÄΨһÒâÒå¾ÍÊǸæËßJVM²»ÐèÒªµÈ´ýËüÍ˳ö£¬ÈÃJVMϲ»¶Ê²Ã´Í˳ö¾ÍÍ˳ö°É£¬²»ÓùÜËü¡£
join·½·¨
join()·½·¨-µÈ´ý¸ÃÏß³ÌÖÕÖ¹£¬ÄÇôÈç¹ûthread_n.join(),¾ÍÊÇ˵µÈ´ýµ±Ç°Ïß³Ì(join()µÄµ÷ÓÃÕß--thread_n)ÖÕÖ¹
notify notifyall
waitÓënotifyÒ»°ãÊÇÅäÌ×ʹÓõģ¬
Ò»¸öÏß³ÌÔÚͬ²½Óï¾äÖе÷ÓÃObject.wait·½·¨£¬Ê¹¸Ã¶ÔÏó»òÀàµÄËøÊͷŵô£¬µÈ´ýCPU·ÖÅäʱ¼äƬ¸øÆäËüỊ̈߳¬µ±ÆäËüÏ̵߳÷ÓÃOjbect.notifyºó£¬wait·½·¨²Å»á·µ»Ø¡£
notifyÓënotifyAllµÄΨһÇø±ð¾ÍÔÚÓÚÏ̵߳÷ÓÃObject.wait·½·¨ºó£¬Óм¸¸öÏß³ÌÔڵȴýÆäËüÏ߳̽«¶ÔÏó»òÀàµÄËøÊͷŵô£¬×¢ÒâÆäËüÏß³ÌûÓе÷ÓÃnotify»ònotifyAllÖ®¼ä£¬µ÷ÓÃObject.waitµÄÏß³ÌÊDz»ÊÇ»ñÈ¡ËøµÄ£¬ËüÃǵÄÇø±ð¾ÍÔÚÓÚÊÇ»½Ðѵ÷ÓÃwait·½·¨µÄÏ̻߳¹ÊÇËùÓеȴýËø±»ÊͷŵÄÏ̡߳£
1¡¢ÕâÁ½¸ö·½·¨À´×Ô²»Í¬µÄÀà·Ö±ðÊÇThreadºÍObject
¡¡¡¡2¡¢×îÖ÷ÒªÊÇsleep·½·¨Ã»ÓÐÊÍ·ÅËø£¬¶øwait·½·¨ÊÍ·ÅÁËËø£¬Ê¹µÃÆäËûÏ߳̿ÉÒÔʹÓÃͬ²½¿ØÖÆ¿é»òÕß·½·¨¡£
¡¡¡¡3¡¢wait£¬notifyºÍnotifyAllÖ»ÄÜÔÚͬ²½¿ØÖÆ·½·¨»òÕßͬ²½¿ØÖÆ¿éÀïÃæʹÓ㬶øsleep¿ÉÒÔÔÚ
¡¡¡¡Èκεط½Ê¹Óã¨Ê¹Ó÷¶Î§£©
¡¡¡¡synchronized(x){
¡¡¡¡x.notify()
¡¡¡¡//»òÕßwait()
¡¡¡¡}
¡¡¡¡4¡¢sleep±ØÐ벶»ñÒì³££¬¶øwait£¬notifyºÍnotifyAll²»ÐèÒª²¶»ñÒì³£
¡¡¡¡À©³äÔĶÁ£º
¡¡¡¡java Ïß³ÌÖеÄsleepºÍwaitÓÐÒ»¸ö¹²Í¬×÷Óã¬Í£Ö¹µ±Ç°Ïß³ÌÈÎÎñÔËÐУ¬µ«ËûÃÇ´æÔÚÒ»¶¨µÄ²»Í¬£¬Ê×ÏÈÎÒÃÇÏÈ¿´sleepÖеĹ¹Ô캯Êý
¡¡¡¡sleep(long millis) Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds, subject to the precision and accuracy of system timers and schedulers.
¡¡¡¡sleep(long millis, int nanos) Causes the currently executing thread to sleep (cease execution) for the specified number of milliseconds plus the specified number of nanoseconds, subject to the precision and accuracy of
Ïà¹ØÎĵµ£º
public class www {
public static void main(String[]args) throws Exception {
//µÚÒ»²½£º¼ÓÔØÇý¶¯£¨Çý¶¯jar°ü±ØÐë¼ÓÈëclasspathÖУ©
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
//µÚ¶þ²½£º½¨Á¢Á¬½Ó£¨¸ù¾Ýʵ¼ÊÇé¿öÌæ»»Êý¾Ý¿âµÄÖ÷»úµØÖ·¡¢¶Ë¿ÚºÅ¡¢Êý¾Ý¿âÃ÷¡¢µÇ¼à ......
ÒªÔÚJavaÖлñµÃijһ±äÁ¿µÄËø£¬±ØÐëÔÚ´úÂëµÄÊ×β¶þ¶Ë¼ÓÉÏsynchronized¹Ø½¡×Ö£¬Ö¸Ã÷ÐèÒª»ñµÃËøµÄ¶ÔÏó¡£Ò»µ©Ï߳̿ªÊ¼Ö´ÐÐsynchronized¿éÖеĴúÂ룬Ëü¾Í»ñµÃÁ˶ÔÕâÒ»¶ÔÏóµÄËøµÄ¿ØÖÆȨ¡£Í¬Ñù£¬Ò»µ©Ïß³ÌÒѾÀ뿪ÁËsynchronized¿é£¬ËüÒ²½«ÊÍ·ÅÕâÒ»¶ÔÏóµÄËø¡£ÎÒÃÇÒѾ֪µÀ£¬C#Ò²ÓÐÒ»¸öÏàËƵı»³Æ×÷lockµÄ¹Ø½¡×Ö¡£³ýÁËlockÕâ¸ö¹Ø½¡×Ö ......
×Ô¼ºµÄÔ´³ÌÐòÊÇÔÚF:\parser\ParserDemo.java£¬
ʹÓÃÃüÁîÐУºjavac -classpath stanford-parser.jar;. ParserDemo.java±àÒ룬
ÃüÁîÐУºjava -cp stanford-parser.jar;. ParserÔËÐÐ
¶¼Ã»ÓÐÎÊÌâ¡£
µ«Êǵ±ÎÒÔÚc++³ÌÐòÖÐʹÓÃÓÃÃüÁîÐУ¨java -cp stanford-parser.jar;. Parser£©µ÷ÓøijÌÐò¾Í»á³ö´í¡£Ìáʾ£ºjava.lang.NoClassD ......
JAVAµ÷ÓÃMYSQL´æ´¢¹ý³Ì
¹¤³ÌÊÓͼ£º
´úÂëÇåµ¥£º
myconn.java
package org.apache.sh_mysql.test;
import java.sql.*;
public class MyConn {
private static final String DRIVER = "com.mysql.jdbc.Driver";
private static final String URL = "jdbc:mysql://localhost/test?useUnicode=true&characterEn ......
´«ÖDz¥¿ÍJAVAÅàѵstruts2ѧϰ±Ê¼ÇÒ»
Àë±ÏÒµÓÖ×ß½üÁËÒ»²½£¬ÐÄÀïÓÖĪÃûµÄ½ôÕÅÆðÀ´¡£½ñÌìÓÐÒ»¸öͬÐĹ«Ë¾·Å¼ÙÐÇÆÚѧУÀ´ÉϿΣ¬ÎÒ¶ÔÆä³ýÁËÅå·þÖ®Í⣬¾ÍÖ»ÓÐÏÛĽÁË£¬¹¤×Ê6.5£Ë¿É²»ÊÇÎÒÏÖÔÚµÄˮƽ
¸ÒÏëµÄºÇ£¬ËäÈ»ÎÒ¶Ô£³£Ç²»ÊǺܸÐÐËȤ£¬ÎÒÒ²¸üÏàÐŽÅ̤ʵµÄÈ¥×ߺÃÿһ²½À´µÃ̤ʵ£¡µ«ÊÇÕ⼸¸öͬѧËùÈ¡µÃ³É¼¨È ......