C̳

 һ
 ע
б
鿴: 9|ظ: 0

[ѧϰʼ] InterfaceDemo_0914_2400

[]
Ѵ
0 
6 ǰ | ʾȫ¥ |Ķģʽ

עᣬύѣø๦^_^

Ҫ ¼ ſػ鿴ûʺţע

x
//ģʽ
//*********************************************************
interface Ieat
{
        public abstract void get();
}
//***************************************************
class EatReal implements Ieat
{
        public void get()
        {
                System.out.println("EatReal==>get()");
        }
}
//***************************************************
class EatProxy implements Ieat
{
        private Ieat eat;
        public EatProxy(Ieat eat)
        {
                this.eat=eat;
        }
        public void prepare()
        {
                System.out.println("EatProxy==>prepare()");
        }
        public void clear()
        {
                System.out.println("EatProxy==>clear()");
        }
        public void get()                //дget()
        {
                this.prepare();
                this.eat.get();                //EatRealеget()??????????
        }
}
//*********************************************
public class InterfaceDemo_0914_2400
{
        public static void main(String[] args)
        {
        Ieat eat=new EatProxy(new EatReal());
        eat.get();
        }
}
֪Сɶ -> ilovefishc.com
ظ

ٱ

б

ֹ

ر

СǿƼһ /1 һ

С|ֻ|Archiver|C ( ICP18085999

GMT+8, 2018-9-21 23:21

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

ٻظ ض б