2013年11月26日

java 设计模式之单利模式以及代理模式(静态)

摘要: 1:单利模式:publicclassSingleton {privatestaticSingletonuniqueInstance=null;privateSingleton() {// Exists only to defeat instantiation. }publicstaticSingleton getInstance() {if(uniqueInstance==null) {uniqueInstance=newSingleton(); }returnuniqueInstance; }// Other methods...}代理模式(静态):package com; /** * 车站 阅读全文

posted @ 2013-11-26 17:19 yujian_bcq 阅读(234) 评论(0) 推荐(0) 编辑

java 设计模式之工厂模式与反射的结合

摘要: 工厂模式: /*** @author Rollen-Holt 设计模式之 工厂模式*/interface fruit{public abstract void eat();}class Apple implements fruit{public void eat(){System.out.print... 阅读全文

posted @ 2013-11-26 16:33 yujian_bcq 阅读(269) 评论(0) 推荐(0) 编辑

java 反射

摘要: 反射详解链接:http://www.cnblogs.com/rollenholt/archive/2011/09/02/2163758.html开始方法 Class cl = Class.forName(mc.getClass().getName());Java Annotation 详解http://www.cnblogs.com/phoebus0501/archive/2011/02/21/1960077.htmlgetFields()获得某个类的所有的公共(public)的字段,包括父类。getDeclaredFields()获得某个类的所有申明的字段,即包括public、private 阅读全文

posted @ 2013-11-26 13:47 yujian_bcq 阅读(140) 评论(0) 推荐(0) 编辑

导航