- - PR -
メソッドは、変数としてメソッド間で受け渡しできないのでしょうか?
«前のページへ
1|2|3
投稿者 | 投稿内容 |
---|---|
|
投稿日時: 2006-10-17 08:34
皆さん、ご親切にアドバイスを頂き、ありがとうございました。
GoFのデザインパターンを勉強して、Interfaceと抽象クラスに関してよく理解できました。 一応ですが、考えているプログラムは下記の応用で実現して行こうと思います。 public class Mains { public static void main(String[] args) { Mains thisclass = new Mains(); Interface test = thisclass.new Carrier("success!"); test.execute(); } interface Interface{ public void execute(); } class Carrier implements Interface{ String item; Carrier(String item){ this.item = item; } public void execute() { System.out.println(item); } } } |
«前のページへ
1|2|3