
java
fondOfJava
这个作者很懒,什么都没留下…
展开
-
java简单的装潢模式
1、目标装饰的类 interface SmallAnimal { void doStuff(); } class Rat implements SmallAnimal { public void doStuff() { System.out.println("Rat doStuff"); } } 2、需要添加的装饰类 interface Feature转载 2014-03-11 22:01:52 · 934 阅读 · 0 评论 -
java模板模式
1、父类 class Person { public final void excute(String methodName) { Method[] mArray = this.getClass().getMethods(); for (Method m : mArray) { if (m.getName().startsWith(methodName) &&转载 2014-03-11 23:06:05 · 878 阅读 · 0 评论 -
java工厂模式的三种方式
1、前置条件 1、1接口 interface Animal { void eat(); } 1、2两个实现类 class Dog implements Animal { public void eat() { System.out.println("Dog eat"); } } class Cat implements Animal { p翻译 2014-03-09 22:00:27 · 966 阅读 · 0 评论 -
java序列化工具类
class SerializationUtils { private SerializationUtils() { throw new UnsupportedOperationException(); } public static void writeObject(Serializable s, String fileNameAndPath) { ObjectOutp转载 2014-03-20 20:32:19 · 1114 阅读 · 0 评论