Revised: Feb./14th/2003; Since: Sep./11th/2001
$BA0@a$G$O%a%=%C%I$N%*!<%P!<%m!<%I$r8+$F$-$^$7$?!#%3%s%9%H%i%/%?$b%*!<%P!<%m!<%I$G$-$^$9!#!&!&!&%3%s%9%H%i%/%?$N9`$G!"4{$K>R2p:Q$_$G$9$1$I$M!#$3$3$G$O(B this()
$B%3%s%9%H%i%/%?$K$D$$$F>R2p$7$^$9!#(B
$B%3%s%9%H%i%/%?$rL@<(E*$KDj5A$7$J$$>l9g!"%3%s%Q%$%i$K$h$C$F!"6u$N%3%s%9%H%i%/%?$,DI2C$5$l$^$9!#
class ConstructorDemo { private int i, j; void getMsg() { System.out.println("i = " + i + ", j = " + j); } }
$B%3%s%9%H%i%/%?$,5-=R$5$l$F$$$^$;$s!#$3$&$9$k$H!"%3%s%Q%$%i$,0z?t$N$J$$%3%s%9%H%i%/%?$r<+F0E*$K:n@.$7$F$/$l$^$9!#(B
$B
class ConstructorDemo { private int i, j; // $BL@<(E*%3%s%9%H%i%/%?(B ConstructorDemo(int x, int y) { i = x; j = y; } void getMsg() { System.out.println("i = " + i + ", j = " + j); } }
$B0z?t$N0[$J$k%3%s%9%H%i%/%?$rJ#?t5-=R$9$k;v$,$G$-$^$9!#(B
class ConstructorDemo { private int i, j; // $BL@<(E*%3%s%9%H%i%/%?#1(B ConstructorDemo(int x, int y) { i = x; j = y; } // $BL@<(E*%3%s%9%H%i%/%?#2(B ConstructorDemo(int x) { i = x; j = 1; System.out.println("j $B$O%G%U%)%k%HCM(B 1 $B$r;H$$$^$9!#(B"); } // $BL@<(E*%3%s%9%H%i%/%?#3(B ConstructorDemo() { i = 1; j = 1; System.out.println("i, j $B$O%G%U%)%k%HCM(B 1 $B$r;H$$$^$9!#(B"); } void getMsg() { System.out.println("i = " + i + ", j = " + j); } }
this()
$B%3%s%9%H%i%/%?(B$BF1$8%/%i%9Fb$N%3%s%9%H%i%/%?$r(B this() $B%a%=%C%I$G8F$S=P$9$3$H$,$G$-$^$9!#@h$[$I$NNc$r!"
class ConstructorDemo { private int i, j; // $BL@<(E*%3%s%9%H%i%/%?(B ConstructorDemo(int x, int y) { i = x; j = y; } // $BL@<(E*%3%s%9%H%i%/%?(B ConstructorDemo(int x) { this(x, 1); System.out.println("j $B$O%G%U%)%k%HCM(B 1 $B$r;H$$$^$9!#(B"); } // $BL@<(E*%3%s%9%H%i%/%?(B ConstructorDemo() { this(1, 1); System.out.println("i, j $B$O%G%U%)%k%HCM(B 1 $B$r;H$$$^$9!#(B"); } void getMsg() { System.out.println("i = " + i + ", j = " + j); } }
$B<+%/%i%9Fb$NJL$N%3%s%9%H%i%/%?$O(B this()
$B$G8F$S=P$;$^$9!#(Bthis()
$B%3%s%9%H%i%/%?$r;H$&>l9g$O!"%3%s%9%H%i%/%?Fb$N:G=i$N9T$K5-=R$7$J$1$l$P$J$j$^$;$s!#8eB3$N>O$G@bL@$9$k7Q>5%/%i%9$K$*$1$k(B super() $B%3%s%9%H%i%/%?(B$B$K;w$F$$$^$9!#(B
SEO | [PR] 爆速!無料ブログ 無料ホームページ開設 無料ライブ放送 | ||