thinking in java µÚÎåÕÂ2 ³õʼ»¯
µÚÒ»µã£º
ÔÚ±àд³ÌÐòµÄ¹ý³ÌÖУ¬java»á±£Ö¤¾¡Á¿ÔÚʹÓõÄʱºò³õʼ»¯£¬ËùÒÔÔÚûÓгõʼ»¯µÄ±äÁ¿ÔÚʹÓùý³ÌÖбàÒëÆ÷»á±¨´í£¬ÕâÀïÎÒÃÇ˵µÄ±äÁ¿ÓÐ2ÖÖ£¬Ò»ÖÖÊÇÈ«¾Ö±äÁ¿£¬Ò»ÖÖÊǾֲ¿±äÁ¿£¬È«¾Ö±äÁ¿±àÒëÆ÷»á×Ô¶¯¸³¸ø³õÖµ£¬¶ø¾Ö²¿±äÁ¿²»ÄÜ£¬¿´ÏÂÃæÀý×Ó£º
public class Chushihua {
private int j;
private Integer i1;
public void f() {
int i;
int n = j * 12;
Integer i2;
// int m = i*12;ûÓгõʼ»¯£¬²»ÄÜʹÓÃ
System.out.println(j);
System.out.println(i1);
// System.out.println(i2); ûÓгõʼ»¯£¬²»ÄÜʹÓÃ
}
public static void main(String[] args) {
new Chushihua().f();
}
}
ËùÒÔ˵¶ÔÏóºÍ±äÁ¿ÊÇÒ»ÑùµÄ£¬È«¾ÖµÄjvm»á¸³¸ø³õÖµ£¬µ«ÊǾֲ¿µÄ±ØÐ븳¸ø³õÖµºó²ÅÄÜʹÓã¬ÔÚʹÓõĹý³ÌÖл¹Òª×¢Òâ±äÁ¿µÄ³õʼ»¯Ë³ÐòµÄÎÊÌâ¡£
µÚ¶þµã£º
¹¹ÔìÆ÷ºÍϵͳ×Ô¶¯³õʼ»¯µÄ˳Ðò£¬
public class Counter {
private Integer i = new Integer(5);
Counter() {
System.out.println(i);
System.out.println(j);
i = new Integer(7);
System.out.println(i);
}
private Integer j;
public static void main(String[] args) {
new Counter();
}
}
Êä³ö½á¹û£º
5
null
7
ÓÉ´ËÀý×Ó¿ÉÒÔ¿´³ö˳Ðò£¬jvm»áÏȶÔÈ«¾Ö±äÁ¿½øÐгõʼ»¯£¬Ò²¾ÍÊǹ¹Ôì·½·¨µÄ¸³Öµ²Ù×÷ÊÇÔÚ³õʼ»¯Ö®ºóµÄ¡£
Ò²¾ÍÊÇÔÚÀàµÄÄÚ²¿£¬±äÁ¿¶¨ÒåµÄÏȺó˳Ðò¾ö¶¨Á˳õʼ»¯µÄ˳Ðò¡£¼´Ê¹±äÁ¿É¢ÂäÔÚ¸÷¸ö·½·¨Ö®¼ä£¬ËûÃÇÈÔ»áÔÚ¹¹ÔìÆ÷֮ǰ³õʼ»¯¡£
¾²Ì¬Êý¾ÝµÄ³õʼ»¯£ºÎÞÂÛ´´½¨¶àÉÙ¸ö¶ÔÏ󣬾²Ì¬¶ÔÏóÖ»Õ¼ÓÐÒ»·Ý´æ´¢ÇøÓò¡£Static¹Ø¼ü×Ö²»ÄÜÓ¦ÓÃÓÚ¾Ö²¿±äÁ¿£¬Òò´ËËûÖ»ÄÜ×÷ÓÃÓÚÓò¡£
×ܽᣬһ¸ö¶ÔÏóÔÚ´´½¨µÄ¹ý³ÌÖеijõʼ»¯¡£
³õʼ»¯µÄ˳ÐòÊÇÏȾ²Ì¬¶ÔÏó£¬È»ºóÊÇ“·Ç¾²Ì¬”µÄ¶ÔÏ󣬲¢ÇÒ¾²Ì¬µÄ¶ÔÏóÔÚµÚÒ»´Î¶ÔÏó³õʼ»¯µÄʱºòÖ»³õʼ»¯Ò»´Î¡£
¹¹ÔìÆ÷ÆäʵҲÊǾ²Ì¬·½·¨¡£
¾²Ì¬³õʼ»¯¿é£¬µ±Ê×´ÎÉú³ÉÕâ¸öÀàµÄÒ»¸ö¶ÔÏóʱ£¬»òÕßÊ״ηÃÎÊÊôÓÚÄǸöÀàµÄ¾²Ì¬Êý¾Ý³ÉԱʱ£¨¼´Ê¹´ÓδÊä³ö¹úÄǸöÀàµÄ¶ÔÏ󣩣¬Õâ¶Î´úÂë½öÖ´ÐÐÒ»´Î¡£·Ç¾²Ì¬µÄ³õʼ»¯¿éÊÀ½çºÍ¾²Ì¬µÄ³õʼ»¯¿éÊÇÒ»ÑùµÄ£¬Ö»ÊÇÉÙÁËstatic
class Cup {
Cup(int i) {
System
Ïà¹ØÎĵµ£º
ÕâƪÎÄÕÂÎÒÊÇ´ÓIBMÍøÕ¾¿´µ½µÄ£¬ºÜÓÐÓ㬾ÍתÌû¹ýÀ´ÁË£¬ÔÎÄÍøÖ·ÊÇhttp://www.ibm.com/developerworks/cn/java/l-console/index.html£¬µ«ÊÇ´ò¿ªµÄʱºòÌرðÂý£¬¾ÍÔÚÕâÀïÕ³Ìùһϡ£
ÔÚJava¿ª·¢ÖУ¬¿ØÖÆ̨Êä³öÈÔÊÇÒ»¸öÖØÒªµÄ¹¤¾ß£¬µ«Ä¬ÈϵĿØÖÆ̨Êä³öÓÐן÷ÖÖ¸÷ÑùµÄ¾ÖÏÞ¡£±¾ÎĽéÉÜÈçºÎÓÃJava¹ÜµÀÁ÷½ØÈ¡¿ØÖÆ̨Êä³ö£¬·ÖÎö¹ÜµÀÁ ......
±¾ÎÄ´Óhttp://www.blogjava.net/breezedancer/archive/2007/07/19/131264.htmlתÔØ
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
//¶ÏµãÐø´ ......
ÓÃspyºÍmemcached for javaÁ½ÖÖ·½Ê½¶Ômemcache½øÐвÙ×÷
Ò»¡¢spy
package com.test.memcache;
import java.net.InetSocketAddress;
import java.util.concurrent.Future;
import net.spy.memcached.MemcachedClient;
/**
* ±¾ÀàÓõİüÊÇmemcached-2.4.1.jar
* ÏÂÔصØÖ·£º http://code.googl ......
JavaÕýÔò±í´ïʽÏê½â
2005-10-08 10:01×÷ÕߣºÏÉÈËÕƹ¤×÷ÊÒ³ö´¦£ºKissJava.comÔðÈα༣ºÍõÓñº
Èç¹ûÄãÔø¾ÓùýPerl»òÈκÎÆäËûÄÚ½¨ÕýÔò±í´ïʽ֧³ÖµÄÓïÑÔ£¬ÄãÒ»¶¨ÖªµÀÓÃÕýÔò±í´ïʽ´¦ÀíÎı¾ºÍÆ¥ÅäģʽÊǶàô¼òµ¥¡£Èç¹ûÄã²»ÊìϤÕâ¸öÊõÓÄÇô“ÕýÔò±í´ïʽ”£¨Regular Expression£©¾ÍÊÇÒ»¸ö×Ö·û¹¹³ÉµÄ´®£¬Ëü¶¨ÒåÁ ......
Õýʽ¿ªÊ¼JavaÁË.
ÏÈÊÇÅäÖÃJava
java_home path classpath(1.5ÒÔÉÏ°æ±¾¿ÉÒÔ²»ÓÃÅäÖÃclasspathÁË)
²»¹ý±¾ßµÄÊÇ.Ò»¿ªÊ¼Àí½â´íÁË.ÒÔΪclasspathµÄ".;"--µ±Ç°Ä¿Â¼ÊÇÖ¸javac X:\aa.javaµÄÄĸöX:Ŀ¼..È»ºójava aa¾Í²»ÓÃÖ¸¶¨ÁË..
ŪÁ˺þö¼²»ÊÇÕâÑùµÄ..»¹ÒÔΪÊÇwin 7µÄÔÒò..Orz
JavaÅäÖúÃÁË.¸ÃÑ¡Îı¾±à¼Æ÷ÁË..
ͬѧ½Ð ......