- PR -

メソッドは、変数としてメソッド間で受け渡しできないのでしょうか?

投稿者投稿内容
しんい
ベテラン
会議室デビュー日: 2005/09/01
投稿数: 55
投稿日時: 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);
}
}
}

スキルアップ/キャリアアップ(JOB@IT)