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

javaÖеĴúÂë¿éÀí½â

´úÂë¿é£º¾ÍÊÇÓÃ{}À¨ÆðÀ´µ½²¿·Ö¡£¸ù¾ÝÓ¦ÓõIJ»Í¬·ÖΪ4Àà:ÆÕͨ´úÂë¿é¡¢¹¹Ôì¿é¡¢¾²Ì¬´úÂë¿é¡¢Í¬²½´úÂë¿é¡£
1.ÆÕͨ´úÂë¿é£º¶¨ÒåÔÚ·½·¨ÖеĴúÂë¿é¡£
È磺
public class Ex22 {

public static void main(String[] args){
// ÆÕͨ´úÂë¿é
{
int i = 3;
System.out.println("¾Ö²¿±äÁ¿Îª " + i);
}
int i = 5;
System.out.println("Ïà¶ÔÉÏÃæµÄ i À´ËµÊÇÈ«¾ÖµÄ±äÁ¿ " + i);

}


}
//¾Ö²¿±äÁ¿Îª 3
//Ïà¶ÔÉÏÃæµÄ i À´ËµÊÇÈ«¾ÖµÄ±äÁ¿ 5
2.¹¹Ôì¿é£ºÖ±½ÓÔÚÀàÖбàдµÄ´úÂë¿é¡£
class Demo5{
{
System.out.println("¹¹Ôì¿é");
}
public Demo5(){
System.out.println("¹¹Ôì·½·¨");
}
{
System.out.println("¹¹Ôì·½·¨ºóµÄ¹¹Ôì¿é");
}
}
public class Ex22 {

public static void main(String[] args){
new Demo5();
new Demo5();

}


}
//¹¹Ôì¿é
//¹¹Ôì·½·¨ºóµÄ¹¹Ôì¿é
//¹¹Ôì·½·¨
//¹¹Ôì¿é
//¹¹Ôì·½·¨ºóµÄ¹¹Ôì¿é
//¹¹Ôì·½·¨

¶ÔÏó±»ÊµÀý»¯Ò»´Î¹¹Ôì¿é¾ÍÖ´ÐÐÒ»´Î£»
¹¹Ôì¿éÓÅÏÈÖ´Ðбȹ¹Ôì·½·¨.
3.¾²Ì¬´úÂë¿é:static ¹Ø¼ü×ÖÉùÃ÷µÄ´úÂë¿é.
class Demo5{
{
System.out.println("1¹¹Ôì¿é");
}
public Demo5(){
System.out.println("2¹¹Ôì·½·¨");
}
{
System.out.println("3¹¹Ôì·½·¨ºóµÄ¹¹Ôì¿é");
}
static {
System.out.println("4¾²Ì¬´úÂë¿é");
}

}
public class Ex22 {
static {
System.out.println("ÔÚÖ÷·½·¨ÀàÖж¨ÒåµÄ´úÂë¿é");
}

public static void main(String[] args){
new Demo5();
new Demo5();

}


}
//ÔÚÖ÷·½·¨ÀàÖж¨ÒåµÄ´úÂë¿é
//4¾²Ì¬´úÂë¿é
//1¹¹Ôì¿é
//3¹¹Ôì·½·¨ºóµÄ¹¹Ôì¿é
//2¹¹Ôì·½·¨
//1¹¹Ôì¿é
//3¹¹Ôì·½·¨ºóµÄ¹¹Ôì¿é
//2¹¹Ôì·½·¨
±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔØÇë±êÃ÷³ö´¦£ºhttp://blog.csdn.net/njiang/arc


Ïà¹ØÎĵµ£º

JavaÄÚ²¿ÀàµÄ×÷ÓÃ

Ò»¡¢ ¶¨Òå
·ÅÔÚÒ»¸öÀàµÄÄÚ²¿µÄÀàÎÒÃǾͽÐÄÚ²¿Àà¡£
¶þ¡¢ ×÷ÓÃ
1.ÄÚ²¿Àà¿ÉÒԺܺõÄʵÏÖÒþ²Ø,Ò²¾ÍÊÇ·â×°ÐÔ¡£Ò»°ãµÄ·ÇÄÚ²¿À࣬ÊDz»ÔÊÐíÓÐ private ÓëprotectedȨÏ޵쬵«ÄÚ²¿Àà¿ÉÒÔ
2.ÄÚ²¿ÀàÓµÓÐÍâΧÀàµÄËùÓÐÔªËØµÄ·ÃÎÊȨÏÞ
3.¿ÉÊÇʵÏÖ¶àÖØ¼Ì³Ð
4.¿ÉÒÔ±ÜÃâÐ޸ĽӿڶøÊµÏÖͬһ¸öÀàÖÐÁ½ÖÖͬÃû·½·¨µÄµ÷ÓÃ
 
Èý¡¢  ......

Java¶àÏ̱߳à³Ì×ܽá

Java¶àÏ̱߳à³Ì×ܽá
 
ÏÂÃæÊÇJavaÏß³ÌϵÁв©ÎĵÄÒ»¸ö±àÄ¿£º
 
JavaỊ̈߳º¸ÅÄîÓëÔ­Àí
JavaỊ̈߳º´´½¨ÓëÆô¶¯
JavaỊ̈߳ºÏß³ÌջģÐÍÓëÏ̵߳ıäÁ¿
JavaỊ̈߳ºÏß³Ì״̬µÄת»»
JavaỊ̈߳ºÏ̵߳Äͬ²½ÓëËø
JavaỊ̈߳ºÏ̵߳Ľ»»¥
JavaỊ̈߳ºÏ̵߳ĵ÷¶È-ÐÝÃß
JavaỊ̈߳ºÏ̵߳ĵ÷¶È-ÓÅÏȼ¶
JavaỊ̈߳ºÏß ......

JavaỊ̈߳º´´½¨ÓëÆô¶¯


JavaỊ̈߳º´´½¨ÓëÆô¶¯
 
SCJP5ѧϰ±Ê¼Ç
 
Ò»¡¢¶¨ÒåÏß³Ì
 
1¡¢À©Õ¹java.lang.ThreadÀà¡£
 
´ËÀàÖÐÓиörun()·½·¨£¬Ó¦¸Ã×¢ÒâÆäÓ÷¨£º
public void run()
Èç¹û¸ÃÏß³ÌÊÇʹÓöÀÁ¢µÄ Runnable ÔËÐжÔÏó¹¹ÔìµÄ£¬Ôòµ÷Óøà Runnable ¶ÔÏóµÄ run ·½·¨£»·ñÔò£¬¸Ã·½·¨²»Ö´ÐÐÈκβÙ×÷²¢·µ»Ø¡£
 
T ......

JavaỊ̈߳ºÏ̵߳ĵ÷¶È ÐÝÃß

JavaỊ̈߳ºÏ̵߳ĵ÷¶È-ÐÝÃß
 
JavaÏ̵߳÷¶ÈÊÇJava¶àÏ̵߳ĺËÐÄ£¬Ö»ÓÐÁ¼ºÃµÄµ÷¶È£¬²ÅÄܳä·Ö·¢»ÓϵͳµÄÐÔÄÜ£¬Ìá¸ß³ÌÐòµÄÖ´ÐÐЧÂÊ¡£
 
ÕâÀïÒªÃ÷È·µÄÒ»µã£¬²»¹Ü³ÌÐòÔ±Ôõô±àдµ÷¶È£¬Ö»ÄÜ×î´óÏ޶ȵÄÓ°ÏìÏß³ÌÖ´ÐеĴÎÐò£¬¶ø²»ÄÜ×öµ½¾«×¼¿ØÖÆ¡£
 
Ïß³ÌÐÝÃßµÄÄ¿µÄÊÇʹÏß³ÌÈóöCPUµÄ×î¼òµ¥µÄ×ö·¨Ö®Ò»£¬Ïß³ÌÐÝÃß ......

java transient¼ò½é

 ÎÒÃǶ¼ÖªµÀÒ»¸ö¶ÔÏóֻҪʵÏÖÁËSerilizable½Ó¿Ú£¬Õâ¸ö¶ÔÏó¾Í¿ÉÒÔ±»ÐòÁл¯£¬javaµÄÕâÖÖÐòÁл¯Ä£Ê½Îª¿ª·¢ÕßÌṩÁ˺ܶà±ãÀû£¬ÎÒÃÇ¿ÉÒÔ²»±Ø¹ØÏµ¾ßÌåÐòÁл¯µÄ¹ý³Ì£¬Ö»ÒªÕâ¸öÀàʵÏÖÁËSerilizable½Ó¿Ú£¬Õâ¸öµÄËùÓÐÊôÐԺͷ½·¨¶¼»á×Ô¶¯ÐòÁл¯¡£
       È»¶øÔÚʵ¼Ê¿ª·¢¹ý³ÌÖУ¬ÎÒÃdz£³£»áÓöµ½ÕâÑ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ