Discussion:
Java 三昧
(too old to reply)
Shinji KONO
2006-10-15 18:19:46 UTC
Permalink
$B2OLn??<#(B @ $BN05eBg3X>pJs9)3X$G$9!#(B

JavaSound $B$r$$$8$C$F$^$9!#(BSun$B$N:n$C$?NcBj$@$J!#(B

JavaSound $B$N%=!<%9<+BN$O$$$8$i$:$K!"7Q>5$7$?%/%i%9$@$1$G?7$7(B
$B$$$b$N$r:n$k$C$F$N$,!"%*%V%8%'%/%H;X8~E*$J$s$@$,(B....

$B%*%V%8%'%/%H$r:n$k;~$KF0$/%a%=%C%I$O(BJava$B$N>l9g$O(B Constructor
$B$H8F$P$l$^$9!#%/%i%9L>$HF1$8%a%=%C%I$,<+F0E*$K$=$&$J$k!#(B

$B$G$b!"(BJavaSound $B$@$H!"(BDefault Constructor $B$,$J$$>l9g$,$"$k!#(B
$B7Q>5$7$?%/%i%9B&$G!"L@<(E*$K?F%/%i%9$N!V4{$K$"$k!W(BConstructor
$B$r8F$VI,MW$,$"$k$i$7$$!#0lJ}$G!"(BDef ault Constructor $B$,$"$k(B
$B%W%m%0%i%`$G!"(BDefault Constructor $B$K!"$,$s$,$s%3!<%I$,=q$$$F(B
$B$"$k!#(B

$B$C$F$3$H$O!"$I$C$A$N>l9g$G$b!"(BConstructor $B$N?6Iq$$$r(BSub Class
$BB&$+$iJQ$($k$3$H$O$G$-$J$$!#$@$a$8$c$s!#$J$N$G!"(BDefault Constructor
$B$,$J$$>l9g$O6u$J$b$N$rIU$12C$(!"(BDefault Constructor $B$K$4$A$c(B
$B$4$A$c=q$$$F$"$k>l9g$O!"M>7W$J0z?t$r;}$D%@%_!<$N6u$J(BConstructor
$B$rIU$12C$($k$C$F$J46$8$GF($2$?$s$@$1$I!#$3$s$J$b$N(B?!

static main(String arg[]) $B$+$i5/F0$9$k$N$O5v$9$s$@$,!"$=$3$K!"(B
$B$^$?!"$$$m$$$m$4$A$c$4$A$c=q$$$F$"$k!#$=$3$G!"(BClass $BL>$r;XDj(B
$B$7$F(Binstance $B$r:n$C$F$7$^$C$F$$$k$+$i!"7Q>5B&$O!"(Bmain $B$r>e=q(B
$B$-$9$k$7$+$J$$!#$G$b!"$=$3$K$4$A$c$4$A$c=q$+$l$F$?$i!"$=$l$r(B
$B%3%T!<$9$k$7$+$J$$!#M>7W$J%3!<%I=q$/$J$iJL%a%=%C%I$K$7$F$/$l(B
$B$F$$$l$P!"LdBj$J$$$N$K!#$"$k$$$O!"(BMyClass self = new this();
self.start(); $B$H$+=q$1$k$N$+(B?

Class $BDj5A$NCf$K6I=jE*$K(B Class $BDj5A$r$9$k(B Inner Class $B$,B?MQ(B
$B$5$l$F$k!#(BInner Cla ss $B$C$F!"(B

$B!!$^$C$?$/!"2?$NLr$K$b$?$?$J$$%4%_$J35G0(B

$B$@$H;W$&!#$=$s$J$KL>A06u4V$,***@Z$+(B? package $B$"$k$N$K(B? $B:FMxMQ(B
$B$9$k;~$K$O!"?F(BClass $B$NCf$N(BInner Class $B$r$5$i$K7Q>5$9$k(BInner
Class$B$r;RB&$K:n$k$J$s$F8@$&$P$+$2$?$O$a$K$J$k!#$=$l$,2DG=$J(B
$B$H$3$m$,!"$5$i$K(B Inner Class $B$NITMW$52C8:$r6/$/$9$k!#$b$A$m(B
$B$s!"?FB&$G$O(B Inner Class $BL>$r;XDj$7$F(Binstance$B$r:n$C$F$$$k$o(B
$B$1$J$N$G!"$=$NItJ,$O!";RB&$K%3%T!<$7$F$d$kI,MW$,$"$k!#$G$J$$(B
$B$H!";RB&$N(BInner Class $B$OQO(Bw$B$l$J$$!#$7$+$b!"$=$NItJ,$K!"$^$?!"(B
$B$4$A$c$4$A$c$7$?%3!<%I$,=q$$$F$"$k!#(B

$B$7$+$b!"(BInner Class $BB&$K(B private method $B$J$s$+$b$"$k!#7Q>5$7(B
$B$?;RB&$+$iMxMQ$G$-$J$$$8$c$s!#(B private method/instance variable
$B$b!"(B

$B!!$^$C$?$/!"2?$NLr$K$b$?$?$J$$%4%_$J35G0(B

$B$@$H;W$&!#$J!<$K$,$&$l$7$$$s$@$+!#KM$O!"$@$^$C$F(B public $B$C$F(B
$B=q$/$h!#9M$($k$N$a$s$I$/$5$$$7!#(B

$B!!M>7W$J35G0$rA}$d$7!"<+5TE*$J@)8B$r2DG=$K$9$k(B

$B$h$j$b!"(BSimple $B$***@8l$GB?MM$J$3$H$,=PMh$kJ}$,$$$$$G$9!#$G$b!"(B
Template $B$H$+!"(BGen eric Data Type $B$H$+!"%9%?%C%/>e$N%*%V%8%'(B
$B%/%H$H$+(B inline $B$H$+$***@o$&$3$H$K$J$k(B C ++ $B$h$j$O!"(BJava $B$NJ}(B
$B$,!"$O$k$+$K$^$7$J$s$@$h$J!#(B

$B$H$$$&$o$1$G!"7k6I!"85$N%=!<%9$bItJ,E*$K=$@5$9$k$O$a$K$J$C$F(B
$B$^$9!#$^!"?M$N=q$$$?%3!<%I$O5$$KF~$i$J$$$b$N$5!#(B


---
Shinji KONO @ Information Engineering, University of the Ryukyus
$B2OLn??<#(B @ $BN05eBg3X9)3XIt>pJs9)3X2J(B
神戸 隆行
2006-10-16 01:17:54 UTC
Permalink
Post by Shinji KONO
$B$C$F$3$H$O!"$I$C$A$N>l9g$G$b!"(BConstructor $B$N?6Iq$$$r(BSub Class
$B$,$J$$>l9g$O6u$J$b$N$rIU$12C$(!"(BDefault Constructor $B$K$4$A$c(B
JavaSound$B$O;H$C$?$3$H$J$$$G$9$+$***@_7W$NNI$70-$7$OJ,$+$j$^$;$s$7!"(B
$B$I$&$$$&5sF0$r$I$&JQ$($?$+$C$?$N$+$o$+$i$J$$$N$G%J%K$G$9$,!"(B
interface$B$@$17Q>5$7$F<BAu$,7Q>5$7$?$$$H$-$O%U%#!<%k%I$K;}$D$H$$$&$N$8$c(B
$B$@$a$@$C$?$s$G$9$+!)(B

$B%3%s%9%H%i%/%?Fb$K$4$A$c$4$A$c$"$k$N$O=i4|2=$K$$$m$$$mLLE]$J@)Ls$,$"$C$F(B
$B$=$&$$$&3&LL$r8+$;$?$/$J$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3%s%]!<%M%s%H$r$=$N$^$^;H$&$H$-$O7Q>5$7$J$/$F$b$h$$$G$9$,!"(B
$B3HD%$7$?$$$H$-$O%3%s%]!<%M%s%H$N3HD%$r%f!<%6!<Dj5A$N%O!<%I%&%'%"!&%/%i%9(B
$BFb$G=q$-$^$9!#(B
Post by Shinji KONO
$B$7$+$b!"(BInner Class $BB&$K(B private method $B$J$s$+$b$"$k!#7Q>5$7(B
$B$?;RB&$+$iMxMQ$G$-$J$$$8$c$s!#(B private method/instance variable
$B$b!"(B
$B!!$^$C$?$/!"2?$NLr$K$b$?$?$J$$%4%_$J35G0(B
$B30It$+$i1*oh$K;H$o$l$k$HFbIt>uBV$***@09g$,5/$3$k(B
$BMxMQ>r7o$N$-$D$$FbIt%a%=%C%I$d%U%#!<%k%I$C$F;~!9$"$k$s$G$9$,!D!#(B
$B$J$$$G$9$+!)(B
$B!J;~$H$7$F%/%i%9$b!#!K(B
$B;d$H$7$F$O8x3+%a%=%C%I$K$D$$$F$O!J%(%i!<$r8!=P$7$FNc30$rEj$2$FCfCG$7$J$$(B
$B8B$j!K<B9T$,=*$o$C$?;~E@$G%*%V%8%'%/%H$NFbIt>uBV$,@09g$7$F$FM_$7$$$N$G!#(B
$B8x3+%U%#!<%k%I$K4X$7$F$O;d$,;H$&$N$O(Bfinal$B$N;~$@$1$G$9!#(B
$B!J(BC#$B$N%W%m%Q%F%#$_$?$$$J5!G=$,$"$C$F$"$H$+$i$G$b%U%C%/$G$-$k$J$i(B
$B$$$$$+$J$H;W$$$^$9$,!#!K(B
Post by Shinji KONO
Template $B$H$+!"(BGen eric Data Type $B$H$+!"%9%?%C%/>e$N%*%V%8%'(B
$B%F%s%W%l!<%H!J$N%3%s%Q%$%k;~$NE83+F0:n!K$N$?$a$K(BC++$B$r;H$&$3$H$,$"$j$^$9!#(B
--
http://www.nerimadors.or.jp/~kando/
***@nerimadors.or.jp
***@hotmail.com : MSN Messenger
Shinji KONO
2006-10-16 03:46:38 UTC
Permalink
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W$&$s$@$1$I!#(B

$B$7$+$b!"<B:]$K$O!"JL%U%!%$%k$N(BHoge$Control.class $B$,=PMh$A$c$&$o$1$G!"(B
$B%U%!%$%k$NG[CVE*$JMxE@$7$+$J$$$_$?$$$G$9$M!#<BAu>e$O!"!VC1$J$k(B
$BJL!9$J%/%i%9!W$H$7$F=hM}$5$l$F$$$k$i$7$$!#KM$O0J2<$NDjM}$,$"$k$H;W$&!#(B

Inner Class $B$G=PMh$k$3$H$O!"(BInner Class $B$J$7$G!"$h$j%(%l%,%s%H$K(B
$B<B8=$G$-$k(B
Post by 神戸 隆行
$BMxMQ>r7o$N$-$D$$FbIt%a%=%C%I$d%U%#!<%k%I$C$F;~!9$"$k$s$G$9$,!D!#(B
$B$J$$$G$9$+!)(B
$B$=$l$r(Bprivate$B$K$9$k$H!"(BSub class $BB&$G$***@09g@-$O!"!V$^$?!"(BSub
class $BB&$GFH<+$K<BAu$9$k!W$7$+$J$$$G$9$h$M!#MxMQ>r7o$,$-$D$$(B
$B$[$I!"(BSub class $BB&$G$***@0$,=P$k$H;W$&!#(BSub class $B$NF0:n$,?F(B
$B%/%i%9$H>WFM$9$k$H$-$K!"?F$,A4It2r7h$7$F$/$l$k$J$i$$$$$s$@$1(B
$B$I!"$=$l$O!"IaDL$OIT2DG=$G$9!#(B

---
Shinji KONO @ Information Engineering, University of the Ryukyus
$B2OLn??<#(B @ $BN05eBg3X9)3XIt>pJs9)3X2J(B
k***@gssm.otsuka.tsukuba.ac.jp
2006-10-16 04:30:42 UTC
Permalink
$B5WLn$G$9!#(B
Post by Shinji KONO
GUI $B$G(B($B:#2s$O(B)$BM>7W$J5!G=$r%3%s%9%H%i%/%?$GN)$A>e$2$A$c$C$F$$(B
$B$k$N$G!"$=$l$rMn$H$5$J$$$H$$$1$J$$$s$G$9!#$3$N<j$N0z$-;;$O7Q(B
$B>5$G$OFq$7$$!#$^$!!"$b$A$m$s!"(Bmain $B$O!"$3$A$i$GA4It:F<BAu$7(B
$B$=$&$G$9$M!";H$$<N$F0J>e$N$3$H$r$7$J$$J}$,$$$$$h$&$J5$$O$7$F$^(B
$B$9!#(BJavaSound$B$_$?$$$KFbB&$N%/%i%9$b7Q>5$7$F3HD%!D$H$+!"$o$1$o$+(B
Post by Shinji KONO
Inner Class $B$G=PMh$k$3$H$O!"(BInner Class $B$J$7$G!"$h$j%(%l%,%s%H$K(B
$B<B8=$G$-$k(B
$B;H$$<N$FFbIt%/%i%9$OJXMx$@$H;W$&$1$I!#%$%Y%s%H%O%s%I%i$H$+$I$&(B
$B$7$^$9$+!#(B

C#$B$N(Bdelegate? $B5WLn(B
Shinji KONO
2006-10-16 06:07:45 UTC
Permalink
Post by k***@gssm.otsuka.tsukuba.ac.jp
$B$=$&$G$9$M!";H$$<N$F0J>e$N$3$H$r$7$J$$J}$,$$$$$h$&$J5$$O$7$F$^(B
$B$9!#(BJavaSound$B$_$?$$$KFbB&$N%/%i%9$b7Q>5$7$F3HD%!D$H$+!"$o$1$o$+(B
....
Post by k***@gssm.otsuka.tsukuba.ac.jp
$B$7$^$9$+!#(B
Call back $B$K;H$&$N$O9gM}E*$J5$$b$9$k$s$@$1$I!"!V%/%i%9$G$"$k(B
$BI,A3@-$"$k$N$+(B? Closure $B$G$$$$$@$m(B?$B!W$H$O;W$$$^$9$M!#(BJava $B$,(B
method $B$X$N%]%$%s%?!"$"$k$$$O(BClosure $B$r!"$=$3$^$G$7$FHr$1$?(B
$B$$5$;}$A$ONI$/$o$+$i$J$$!#$=$N3d$K$O!"(BInner Class, Anonymous
Class $B$H$+F~$l$^$/$C$F$k$7!#(B

Constructor $B$"$?$j$O!"7k9=!"KbJ*$,$$$k46$8$G$9$M!#(B

Default Constructor $B$OL@<(E*$K=q$1(B
$B$=$7$F!"2?$b$9$k$J(B

$B$C$F$J46$8$+$J$!!#(B

synchronized $B$b!V$(!"7k6I!"(Block $B$O!"$I$3$NC/$K3]$+$k$N(B?$B!W(B
$B$C$F$J$H$3$m$,$"$C$F!"JL$K!"(B
Lock lock = new Lock();
lock.lock();
$B$HL@<($7$F$b!"NI$+$C$?$s$8$c$J$$$+$C$F5$$b$7$^$9$M!#$G$b!"(Bwait()
$B$r(BConditional variable $B$H7k$S$D$1$?$N$O5$$,8z$$$F$$$k$H$O;W(B
$B$C$?!#(B

---
Shinji KONO @ Information Engineering, University of the Ryukyus
$B2OLn??<#(B @ $BN05eBg3X9)3XIt>pJs9)3X2J(B
k***@gssm.otsuka.tsukuba.ac.jp
2006-10-16 07:52:48 UTC
Permalink
$B5WLn$G$9!#(B
$B%/%m!<%8%c$@$C$F%*%V%8%'%/%H$G$7$g!#$@$C$?$iB>$N%*%V%8%'%/%H$H(B
$BF1$8%/%i%9$K$9$k$H$$$&$N$OLLGr$$!#(B
Post by Shinji KONO
Constructor $B$"$?$j$O!"7k9=!"KbJ*$,$$$k46$8$G$9$M!#(B
$B$=$7$F!"2?$b$9$k$J(B
$B$C$F$J46$8$+$J$!!#(B
$B$J$k$[$I$M!#(B
Post by Shinji KONO
synchronized $B$b!V$(!"7k6I!"(Block $B$O!"$I$3$NC/$K3]$+$k$N(B?$B!W(B
$B$C$F$J$H$3$m$,$"$C$F!"JL$K!"(B
Lock lock = new Lock();
lock.lock();
$B$G$b!"(Bwait() $B$r(BConditional variable $B$H7k$S$D$1$?$N$O5$$,8z$$$F(B
$B$$$k$H$O;W$C$?!#(B
$B$=$l$C$F(BHoare$B$,%s==G/A0$K$d$C$?$3$H$G$7$g(B -_-; $B5WLn(B
Loading...