/**Java : : 。
A d a p t e r 。
: , 。
, ( ) 。
( A d a p t e r ) ,
。 。
*/
/**
*
* @ClassName: Adaptee
* @Description: TODO
* @author Administrator
* @date Mar 2, 2011 5:00:20 PM
*
*/
public class Adaptee {
public int get220v() {
return 220;
}
}
/**
*
* @ClassName: Target
* @Description: TODO
* @author Administrator
* @date Mar 2, 2011 5:04:22 PM
*
*/
public interface Target {
public int get110v();
public int get220v();
}
/**
*
* @ClassName: Adapter
* @Description: TODO
* @author Administrator
* @date Mar 2, 2011 5:04:57 PM
*
*/
public class Adapter extends Adaptee implements Target {
public int get110v() {
return 110;
}
}
/**
*
* @ClassName: Client
* @Description: TODO
* @author Administrator
* @date Mar 2, 2011 5:05:37 PM
*
*/
public class Client {
public static void main(String[] args) {
Target target = new Adapter();
int t1 = target.get110v();
int t2 = target.get220v();
System.out.println(t1+" " +t2);
}
}