$B%*!<%P!<%i%$%I(B

Revised: Sep./11th/2002: Since: Dec./30th/2001

$B%*!<%P!<%i%$%I$O!V>e=q$-!W$N$3$H$G$9!#(B$B7Q>5(B$B;~$K!"%9!<%Q!<%/%i%9$GDj5A$5$l$?%a%=%C%I$H(B$BF1$8L>A0!"0z?t$r;}$D%a%=%C%I(B$B$r!"%5%V%/%i%9$G$b$&0lEYDj5A$9$k$3$H$G$9!#(B

$B0l$D$N%/%i%9Fb$G!"F1$8L>A0$N%a%=%C%I$rJ#?tDj5A$9$k$3$H$r(B$B%*!<%P!<%m!<%I(B$B$H8@$$$^$7$?!#8@MU$,;w$F$$$k$N$G4V0c$($d$9$$$N$G$9$,!"A4$/$NJLJ*$G$9!#(B

$B%a%=%C%I$N%*!<%P!<%i%$%I(B

$BOverrideKo $B%/%i%9$,(B OverrideOya $B%/%i%9$r(B$B7Q>5(B$B$7!"%a%=%C%I(B retMsg() $B$,(B$B%*!<%P!<%i%$%I(B$B$5$l$F$$$^$9!#(B

OverrideDemo.java:

class OverrideOya {
	public void retMsg() {
		System.out.println("$B?F$N%a%C%;!<%8(B");
	}
}
class OverrideKo extends OverrideOya {
	public void retMsg() {
		System.out.println("$B;R6!$N%a%C%;!<%8(B");
	}
}
class OverrideDemo {
	public static void main(String[] args) {
		OverrideKo objKo = new OverrideKo();
		objKo.retMsg();
	}
}
C:\java>javac OverrideDemo.java
C:\java>java OverrideDemo
$B;R6!$N%a%C%;!<%8(B
C:\java>

$B=$>~;R(B

$B%"%/%;%9=$>~;R(B

$B%"%/%;%9=$>~;R$O!"%"%/%;%9@)8B$rprotected $B%a%=%C%I$O(B public $B$KJQ99$G$-$^$9$,!"%"%/%;%9=$>~;R$N$J$$%a%=%C%I$r(B private $B@k8@$9$k$3$H$O$G$-$^$;$s!#(B

$B%"%/%;%9=$>~;R$N5,B'$NNc30$H$7$F!"(Bprivate $B=$>~$5$l$?%a%=%C%I$O%*!<%P!<%i%$%I$G$-$^$;$s!#(Bprivate $B=$>~$5$l$?%a%s%P!<$O!"F1$8%Q%C%1!<%8Fb$N%5%V%/%i%9$+$i$b8+$($J$$!?7Q>5$5$l$J$$$N$G!"%*!<%P!<%i%$%I$G$O$J$/!"$^$C$?$/JL$N%a%=%C%I$H$7$F

$B=>$C$F!"(B private $B%a%=%C%I$r(B abstract $B=$>~$9$k$3$H$O$G$-$^$;$s!#%3%s%Q%$%k!&%(%i!<$H$J$j$^$9!#(B

static $B=$>~;R(B

static $B=$>~;R$,@k8@$5$l$?%a%=%C%I$O!"%*!<%P!<%i%$%I;~$K$b(B static $B=$>~;R$,I,?\$G$9!#(Bstatic $B=$>~$5$l$?%a%=%C%I$r%/%i%9!&%a%=%C%I$H8F$S$^$9!#(B

static$B$J%a%=%C%I$r%*!<%P!<%i%$%I$K$h$C$FHs(Bstatic$B%a%=%C%I$K$9$k$3$H$O$G$-$^$;$s!#$=$N5U$K!"Hs(B static $B$J%a%=%C%I$r(B static $B$J%a%=%C%I$K%*!<%P!<%i%$%I$9$k$3$H$b$G$-$^$;$s!#(Bstatic -> $BHs(Bstatic $B$O(B$B8@8l;EMM(B$B$G6X;_$5$l$F$$$^$9!#5U$N!"Hs(Bstatic -> static $B$N>l9g$O!"(B$B8@8l;EMM(B$B$G6X;_$5$l$F$$$k$o$1$G$O$J$$$N$G$9$,!"%9!<%Q!<%/%i%9$X$N7?E,9g;~$KL7=b$r$-$?$9$b$N$H;W$o$l$^$9!#(B

$B>0!"(Bprivate $B%a%=%C%I$HF1MM$K!"(B static $B=$>~$5$l$?%/%i%9%a%=%C%I$r(B abstract $B=$>~$9$k$H%3%s%Q%$%k!&%(%i!<$H$J$j$^$9!#(B

$B%9!<%Q!<%/%i%9$H%5%V%/%i%9$G$N!"Hs(Bstatic <-> static $B4V$N:FDj5A$d(B private $B%a%s%P!<$N:FDj5A$O!"8@8l;EMM>e5v$5$l$^$;$s!#$7$+$7$J$,$i!"(Bstatic <-> static $B$d(B private $B$J%a%s%P!<$O%5%V%/%i%9$G:FD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$$$F$O!"$9$G$K@bL@$7$^$7$?!#;D$k$O%A%'%C%/BP=hNc30$N%9%m!<$G$9!#(B

$BNc30(B$B$O!"(Bjava.lang.Throwable $B%/%i%9$N%5%V%/%i%9$G$"$j!"Bg$-$/J,$1$k$H;0$D$KJ,$+$l$^$9!#(B

java.lang.Object
  |
  +--java.lang.Throwable
       |
       +--java.lang.Error
       |
       +--java.lang.Exception
            |
            +--java.lang.RuntimeException

$BNc30$N;0$D$N%0%k!<%W$N$&$A!"%A%'%C%/BP>]Nc30$O!"%"%W%j%1!<%7%g%sB&$GNc30=hM}$N%m%8%C%/$rAH$_9~$`I,MW$,$"$j$^$9!#Nc30=hM}J}K!$O!"(Btry {} catch () {} $B9=J8$GFbItE*$K=hM}$9$k$b$N$H!"%a%=%C%I$N(B throws $B%j%9%H$K@k8@$7$F8F$S=P$785$K=hM}$r0Q>y$9$k$b$N$KJ,$1$i$l$^$9!#(B

throws $B%j%9%H$,5-=R$5$l$F$$$k%a%=%C%I$r%*!<%P!<%i%$%I$9$k$H$-$O!"%*!<%P!<%i%$%IBP>]$,%9%m!<$7$&$kNc300J30$O;XDj$G$-$^$;$s!#$?$H$($P!"%*!<%P!<%i%$%IBP>]%a%=%C%I$,(B Exception $B%/%i%9$r(B throws $B%j%9%H$K5-=R$7$F$$$l$P!"%*!<%P!<%i%$%I%a%=%C%I$G$O(B Exception $B$N$9$Y$F$N%5%V%/%i%9$r(B throws $B%j%9%H$K5-=R$G$-$^$9!#0lJ}!"(B $B%*!<%P!<%i%$%IBP>]%a%=%C%I$G$O(B IOException $B$@$1$,(B throws $B%j%9%H$K5-=R$5$l$F$$$?$i!"(B IOException $B$N%5%V%/%i%90J30$NNc30$O(B throws $B%j%9%H$K5-=R$G$-$^$;$s!#(B

$BNc30$K$D$$$F$O!"(B$B8eB3$N>O(B$B$G>\:Y$K@bL@$7$^$9!#(B



Copyright © 2001-2002 SUGAI, Manabu. All Rights Reserved.
SEO [PR] 爆速!無料ブログ 無料ホームページ開設 無料ライブ放送