Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

java ¶àÏß³Ì ×¨Ìâ

CoreJava¶àÏß³Ì
Ï̵߳ĸÅÄ
Ïß³ÌÖ¸½ø³ÌÖеÄÒ»¸öÖ´ÐÐÁ÷³Ì£¬Ò»¸ö½ø³Ì¿ÉÒÔ°üº¬¶à¸öÏ̡߳£
ÿһ¸ö½ø³Ì¶¼¶ÀÏíÒ»¿éÄÚ´æ¿Õ¼ä¡£Ã¿¸ö½ø³Ì¶¼ÐèÒª²Ù×÷ϵͳΪÆä·ÖÅä¶ÀÁ¢µÄÄÚ´æµØÖ·£¬¶øͬһ½ø³ÌÖеĶà¸öÏß³ÌÔÚͬһ¿éµØÖ·¿Õ¼ä¹¤×÷£¬ËûÃǹ²ÏíÒ»¿éÄÚ´æºÍ×ÊÔ´¡£
javaÖÐÓÐÁ½Öз½·¨´´½¨Ò»¸ö¶àÏß³ÌÀࣺ
1¡¢¼Ì³Ðjava.lang.ThreadÀ࣬¸²¸ÇThreadÀàµÄrun()·½·¨
2¡¢ÊµÏÖRunnable½Ó¿Ú£¬ÊµÏÖRunnable½Ó¿ÚµÄrun()·½·¨¡£ÍƼöʹÓõڶþÖÖ£¬ÒòΪµÚ¶þÖÖ¸ü¼ÓµÄÁé»î¡£
 
 
ÿ´Îµ÷ÓÃjava.exeµÄʱºò²Ù×÷ϵͳ¶¼»áÆô¶¯Ò»¸öJVM½ø³Ì£¬µ±Æô¶¯JVMµÄʱºò£¬JVM¶¼»á´´½¨Ò»¸öÖ÷Ị̈߳¬¸ÄÏ̴߳ӳÌÐòÈë¿Úmain·½·¨¿ªÊ¼Ö´ÐУ¬Õâ¸öÏ̵߳ÄÃû×־ͽÐmain£¬¿ÉÒÔÔÚmain·½·¨ÖдòÓ¡Ïß³ÌÃû£º
System.out.println( Thread.currentThread().getName())À´²âÊÔ¡£
 
×¢Ò⣺ÿ´Î³ÌÐòÔËÐеÄʱºò³ýÁË×Ô¶¨ÒåµÄÏß³ÌÍ⻹ÓÐÒ»¸ömainÏ̡߳£
 
Ï̵߳ĵ÷¶È
sleep(xxx)£¬Ö¸µ±Ç°ÔËÐеÄÏß³Ì˯ÃßxxxÃ룬˯ÃßµÄʱºòµ±Ç°Ï̻߳ύ³öCPU£¬µ«ÊDz»»á½»³ö¶ÔÏóµÄËø£¡
 
yield()£¬Ö¸µ±Ç°ÔËÐеÄÏ߳̽»³öCPU£¬¸øÆäËûÏß³ÌÔËÐеĻú»á¡£
 
join()£¬Ö¸½«CPU½»¸øµ÷ÓÃjoin()·½·¨µÄÏ̶߳ÔÏó£¬Ö±µ½¸ÃÏß³ÌÔËÐнáÊø¡£
 
Ï̵߳ĸ÷ÖÖ״̬
н¨×´Ì¬(new) //Ï̸߳ձ»´´½¨³öÀ´
        Runnable r = new ThreadTest2();
        Thread t1 = new Thread(r,"t1");//´´½¨Ïß³Ìt1 Ï̴߳¦ÔÚnew״̬
 
¾ÍÐ÷״̬(Runnable)
        t1.start();//Æô¶¯Ïß³Ìt1£¬ÕâʱºòËû´¦ÔÚRunnable״̬£¬µÈ´ýCPUµÄµ÷¶È¡£
 
ÔËÐÐ״̬(Running)
       Èç¹û´¦ÔÚRunnable״̬µÄỊ̈߳¬±»µ÷¶È»ñµÃcpu£¬ÄÇôËû¾Í´¦ÔÚRunning״̬
 
×èÈû״̬(Blocked)
       Èç¹ûRunningÖеÄÏ̵߳÷ÓÃsleep(),yield()»òÕß³ÌÐòÔËÐе½µÈ´ýÊäÈëµÄ·½·¨Ê±£¬Ëû¾Í´¦ÔÚ×èÈû״̬¡£
       Èç¹ûÖ´Ðе½ÁËwait()Óï¾ä£¬ÊÍ·ÅËø±ê¼Ç£¬²¢½øÈëµÈ´ý³ØÖС£Ö±µ½Ä³¸öÏ̵߳÷ÓÃnotifyAll()·½·¨½«Æä´Ó¶ÔÏóµÄµÈ´ý³Øת½øËø³Ø£¬µÈ´ýËø±ê¼Ç£¡
 
ËÀÍö״̬(Dead)
       Ïß³ÌÖ´ÐÐÍê±Ï£¬¾Í´¦ÓÚËÀÍö״̬¡£
 
Ḭ̈߳²È«µÄ¿ØÖÆ
¹Ø¼ü¾ÍÊÇʹÓãºsynchronized ¡¢ wait() ºÍ notifyAll()  &


Ïà¹ØÎĵµ£º

javaÈëÃÅ

 Javaѧϰ´ÓÈëÃŵ½¾«Í¨ 
Ò»¡¢ JDK (Java Development Kit) 
JDKÊÇÕû¸öJavaµÄºËÐÄ£¬°üÀ¨ÁËJavaÔËÐл·¾³£¨Java Runtime Envirnment£©£¬Ò»¶ÑJava¹¤¾ßºÍJava»ù´¡µÄÀà¿â(rt.jar)¡£²»ÂÛʲôJavaÓ¦Ó÷þÎñÆ÷ʵÖʶ¼ÊÇÄÚÖÃÁËij¸ö°æ±¾µÄJDK¡£Òò´ËÕÆÎÕJDKÊÇѧºÃJavaµÄµÚÒ»²½¡£×îÖ÷Á÷µÄJ ......

Javaʼþ»úÖÆ

 Ê¼þÔ´¸ºÔð²úÉúʼþ
ʼþÀࣺ¶¨ÒåʼþµÄÌØÕ÷£»
¼àÌýÆ÷½Ó¿Ú£º¶¨Òå¼àÌýÆ÷Ó¦¸ÃʵÏֵŦÄÜ£»
¼àÌýÆ÷£ºÊµÏÖ¼àÌýÆ÷½Ó¿Ú£¬¼àÌýʼþµÄ·¢Éú²¢×÷³öÏìÓ¦£»
ËùÓеÄʼþÀà±ØÐë¼Ì³ÐJavaʼþ»ùÀ࣬¼´java.util.EventObject£»EventObject(Object source)ÊÇEventObjectΨһµÄ¹¹Ôì·½·¨£¬ÕâÒâζ×ÅËùÓÐʼþ±ØÐëÔÚʵÀý»¯Ê±¾ÍÖ¸¶¨Ê¼þÔ´ ......

java.lang.OutOfMemoryError: Java heap space

 
ÎÊÌâÃèÊö
Exception in thread "main" java.lang.OutOfMemoryError:
Java heap space
½â¾ö·½°¸[ת]
Ò»Ö±¶¼ÖªµÀ¿ÉÒÔÉèÖÃjvm heap´óС£¬Ò»Ö±ÓÃeclipseд/µ÷ÊÔjava³ÌÐò¡£Ò»Ö±ÓÃÃüÁîÐÐor
console¼Ó²ÎÊýÅܳÌÐò¡£ÏÖÏó£ºÔÚeclipseµÄÅäÖÃÎļþeclipse.iniÖÐÉèÖÃ-vmargs -Xms500m
-Xmx1024m
£¬ÔÚeclipseÖ ......

ÀûÓÃjava Api½âÎöXML

import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import or ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ