thinking in javaµÚÎåÕÂ1 ³õʼ»¯ÓëÇåÀí
µÚһ֪ʶµã£º¹¹ÔìÆ÷£¬¹¹ÔìÆ÷ºÍÀàÃûÒ»Ö£¬ÎÞ·µ»ØÖµ£¬ÔÚjavaÖГ³õʼ»¯”Óë“´´½¨”ÊÇÁ¬ÔÚÒ»ÆðµÄ£¬ËùÒÔÎÒÃǾ³£Óù¹ÔìÆ÷ÔÚ´´½¨¶ÔÏóµÄʱºòÀ´³õʼ»¯ÀàµÄһЩʵÀý¡£ÌØÊâ˵Ã÷£ºnew±í´ïʽ·µ»ØÁ˶Ôн¨¶ÔÏóµÄÒýÓ㬵«Êǹ¹ÔìÆ÷±¾ÉíûÓзµ»ØÈκÎÖµ¡£
µÚ¶þ¸ö֪ʶµã£º·½·¨µÄÖØÔØ£¬Ãû³ÆÏàͬ£¬²ÎÊý²»Í¬µÄ·½·¨½Ð×ö·½·¨µÄÖØÔØ¡£²ÎÊý˳ÐòµÄ²»Í¨Ò²ÄÜÇø·Ö·½·¨µÄÖØÔØ£¬µ«ÊÇÒÔ·µ»ØÖµÊǵIJ»Í¨ÊÇÎÞ·¨Çø·Ö·½·¨µÄÖØÔصġ£Éæ¼°µ½»ù±¾ÀàÐ͵ÄÖØÔØ£¬»ù±¾ÀàÐÍÄÜ´ÓÒ»¸ö½ÏСµÄÀàÐÍ×Ô¶¯ÌáÉýÖÁÒ»¸ö½Ï´óµÄÀàÐÍ£¬´Î¹ý³ÌÒ»µ©Éæ¼°µ½ÖØÔØ£¬¿ÉÄÜ»áÔì³ÉһЩ»ìÂÒ£¬ÇëÔÚÔËÓõÄʱºò×¢Ò⣬
char-int-long-float-double
This¹Ø¼ü×ÖÊÇÖ¸Õâ¸ö¶ÔÏó»òÕßÊǵ±Ç°¶ÔÏ󣬶øÇÒËû±¾ÉíÊǶԵ±Ç°¶ÔÏóµÄÒýÓá£Çë¿´ÏÂÃæÀý×Ó£º
ThisµÚÒ»ÖÖÓ÷¨£¬·µ»Øµ±Ç°¶ÔÏó
public class Leaf {
int i = 0;
public Leaf increment() {
i ++ ;
return this;
}
public void print() {
System.out.println(" i= " + i);
}
public static void main(String[] args) {
new Leaf().increment().increment().increment().print();
}
}
Êä³ö½á¹ûi=3
ThisµÚ¶þÖÖÓ÷¨£¬ÓÃÔÚ¹¹ÔìÆ÷ÖÐÌí¼Ó²ÎÊý£¬µ÷Ó÷ûºÏ²ÎÊýµÄ¹¹Ôì·½·¨
public class Flower {
private int count = 0;
private String s = "java";
public Flower(String s) {
this.s = s;
// this(1); ±ØÐë·ÅÔÚµÚÒ»ÐÐ
System.out.println("s=" + s);
}
public Flower(int count) {
this("123");
this.count = count;
System.out.println("count=" + count);
}
public Flower(int count, String s) {
this();
// this("qw"); Ö»Äܵ÷ÓÃÒ»¸ö¹¹ÔìÆ÷
this.count = count;
this.s = s;
System.out.println("count=" + count + " s=" + s);
}
public Flower() {
// this(); ²»Äܵ÷Óñ¾¹¹ÔìÆ÷
System.out.println("------");
}
void print() {
// this();²»ÄÜÔÚÈκη½·¨Öе÷Óù¹ÔìÆ÷£¨°üÀ¨¾²Ì¬·½·¨£©
System.out.println("count=
Ïà¹ØÎĵµ£º
jdkµÄ°²×°
1¡¢´Ójava.sun.com¸ãÏÂjdk×îеİ汾£¬Ò»°ãÎÒÃÇÓÃ1.6°æ±¾µÄ£¬ÏÂÔØbin¸ñʽµÄjdk£¬¼Ù¶¨ÏÂÔصÄÎļþÃûΪjdk-6u20-linux-i586.bin¡£
2¡¢chmod u+x jdk-6u20-linux-i586.bin;È»ºó ./jdk-6u20-linux-i586.bin ½âѹ£¬¼Ù¶¨½âѹºóµÄÎļþ¼ÐΪ jdk1.6_20;
3¡¢ÔÚ/usr/local/ ½¨Á¢Ò»¸öinstallµÄĿ¼£¬ È»ºó°Ñ½âÑ ......
×¢Ê͵ÄÔÔò 1¡¢ ×¢ÊÍÐÎʽͳһ ÔÚÕû¸öÓ¦ÓóÌÐòÖУ¬Ê¹ÓþßÓÐÒ»ÖµıêµãºÍ½á¹¹µÄÑùʽÀ´¹¹Ôì×¢ÊÍ¡£Èç¹ûÔÚÆäËûÏîÄ¿×é·¢ÏÖËûÃǵÄ×¢Ê͹淶ÓëÕâ·ÝÎĵµ²»Í¬£¬°´ÕÕËûÃǵĹ淶д´úÂ룬²»ÒªÊÔͼÔڼȳɵĹ淶ϵͳÖÐÒýÈëеĹ淶¡£ 2¡¢ ×¢Ê͵ļò½à ÄÚÈÝÒª¼òµ¥¡¢Ã÷ÁË¡¢º¬Òå׼ȷ£¬·ÀÖ¹×¢Ê͵ĶàÒåÐÔ£¬´íÎóµÄ×¢ÊͲ»µ«ÎÞÒæ·´¶øÓк¦¡£ ......
//дÕâ¸ö³ÌÐòҲΪÁ˼ÍÄîÍõ½ÃñÏÈÉú……»°Ëµµ±ÄêËûÒ²ÊÇд¹ýÕâ¸öÀàËƳÌÐò
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class game extends Applet implements ActionListener{
//¶¨Òå±äÁ¿
int num1, num2, num3, jieguo, jilu, ......
http://hi.baidu.com/0_net/blog/item/8566fc2bb730c293033bf63e.html
Ò».»ñµÃ¿ØÖÆ̨Óû§ÊäÈëµÄÐÅÏ¢
/** *//**»ñµÃ¿ØÖÆ̨Óû§ÊäÈëµÄÐÅÏ¢
* @return
* @throws IOException
*/
public St ......
JavaÎÊÌâ¾µä32ÎÊ
µÚÒ»£¬Ì¸Ì¸final£¬ finally£¬ finalizeµÄÇø±ð¡£
µÚ¶þ£¬Anonymous Inner Class £¨ÄäÃûÄÚ²¿Àࣩ ÊÇ·ñ¿ÉÒÔextends£¨¼Ì³Ð£©ÆäËüÀ࣬ÊÇ·ñ¿ÉÒÔimplements£¨ÊµÏÖ£©interface£¨½Ó¿Ú£©£¿
µÚÈý£¬Static Nested Class ºÍ Inner ClassµÄ²»Í¬£¬ËµµÃÔ½¶àÔ½ºÃ£¨ÃæÊÔÌâÓе ......