Java 设计模式 之 适配器

http://www.verejava.com/?id=16998997872057

package com.adapter.theory;

public class TestBattery
{
	public static void main(String[] args)
	{
		Plug plug=new AdapterPlug();
		System.out.println(plug.recharge());
		
	}
}





package com.adapter.theory;

public interface Plug
{
	public int recharge();
}





package com.adapter.theory;

public class BigPlug
{

	public int recharge()
	{
		return 100;
	}

}





package com.adapter.theory;

public interface Plug
{
	public int recharge();
}


http://www.verejava.com/?id=16998997872057

posted @ 2018-06-28 09:10  verejava  阅读(101)  评论(0编辑  收藏  举报