javaÖÐthisºÍsuperµÄÓ÷¨
thisµÄÓ÷¨ÔÚjavaÖдóÌå¿ÉÒÔ·ÖΪ3ÖÖ£º
//1.ÆÕͨµÄÖ±½ÓÒýÓÃ
class test {
private int x,y;
public test(int x,int y) {
setX(x);//Ò²¿ÉÒÔдΪthis.setX(x);ÕâÖÖÇé¿öÏÂthis¿ÉÒÔÊ¡ÂÔ.
}
}
//2.·½·¨ÖеÄij¸öÐβÎÃûÓ뵱ǰ¶ÔÏóµÄij¸ö³ÉÔ±ÓÐÏàͬµÄÃû×Ö.ΪÁ˲»»ìÏý,ʹÓÃthisÇø·ÖÓÐthisÒýÓõÄÊdzÉÔ±,ûÓÐthisÊÇÐβÎ
class test {
private int x,y;
public test(int x,int y) {
setX(x);//Ò²¿ÉÒÔдΪthis.setX(x);ÕâÖÖÇé¿öÏÂthis¿ÉÒÔÊ¡ÂÔ.
}
setX(int x){
this.x = x;//this.xÊÇÒýÓõĶÔÏó,xÊÇsetX(int x)ÖеÄÐвÎx
}
}
//3.ÒýÓù¹Ô캯Êý
class test.{
public int x,y;
public test(int x,int y){
this.x = x;
this.y = y;
}
public test(){
this.(2,0)//¹¹Ô캯Êýµ÷ÓÃÆäËû¹¹Ô캯ÊýµÄ·½·¨,Õâ¸öÀý×Óµ÷ÓÃÉÏÃæÄǸö¸´Óù¹Ô캯ÊýµÄ·½·¨
}
}
package test;
public class ThisTest {
private int i=0;
//µÚÒ»¸ö¹¹ÔìÆ÷£ºÓÐÒ»¸öintÐÍÐβÎ
ThisTest(int i){
this.i=i+1;//´Ëʱthis±íʾÒýÓóÉÔ±±äÁ¿£é£¬¶ø·Çº¯Êý²ÎÊý£é
System.out.println("Int constructor i——this.i: "+i+"——"+this.i);
System.out.println("i-1:"+(i-1)+"this.i+1:"+(this.i+1));
//´ÓÁ½¸öÊä³ö½á¹û³ä·ÖÖ¤Ã÷ÁËiºÍthis.iÊDz»Ò»ÑùµÄ£¡
}
// µÚ¶þ¸ö¹¹ÔìÆ÷£ºÓÐÒ»¸öStringÐÍÐβÎ
ThisTest(String s){
System.out.println("String constructor: "+s);
}
Ïà¹ØÎĵµ£º
http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp
Categories of Java HotSpot VM Options
Standard options recognized by the Java HotSpot VM are described on the Java Application Launcher reference pages for Windows
, Solaris
and Linux
. This document deals exclusively wit ......
Ŀ ¼
1 ¼¯ºÏ¿ò¼Ü... 2
1.1 ¼¯ºÏ¿ò¼Ü¸ÅÊö... 2
1.1.1 ÈÝÆ÷¼ò½é... 2
1.1.2 ÈÝÆ÷µÄ·ÖÀà... 4
1.2 Collection. 5
1.2.1  ......
/************************************************************************
* & ......
ÄÇÌì°á¼ÒµÄʱºò²Å·¢ÏÖÓкܶàµÄ¶«Î÷£¬»¹¼ÇµÃÎÒ¸ÕÀ´µ½±±¾©µÄʱºòÕÒÁË·¿×Ó¾ÍһֱסÔÚÕâÀï¡£¿ªÊ¼Ã¦Âµ×ÅÕÒ¹¤×÷¡£ÕÒµ½Õâ·Ý¹¤×÷µÄʱºò±¾À´ÊÇÏë»»×ÅÄØ£¬Ã¿Ìì¶¼ÊÇ×öһЩÎÄ×Ö¼ÈëµÄ¹¤×÷·¢³îµÄÎÒ£¬²»¹ýÔÚÕâÀïÒ²ÊÇÓз¢Õ¹µÄ»ú»á£¬ÓеÄʱºòÕûÀíһЩ¹ØÓÚÊý¾Ý·½ÃæµÄ£¬ÈÃÐÂÀ´µÄ°ÑÊý¾Ý¼Èëµ½µçÄÔÉÏ£¬ÎÒÃÇÒ²ÊÇ×öÍâ°üµÄ¡£µ«Ê ......