摘要: 1,单例类的实现. 可以保证在非同时多线程多类加载器的环境下的单例publicclassSingleton...{privatestaticSingletoninstance;//私有化构造方法来防止外部通过new来创建该类的实例privateSingleton()...{}//使用synchronzied保证线程安全publicsynchronizedstaticSingletongetInstance()...{if(instance==null)...{instance=newSingleton();}returninstance;}}2.单例注册表的实现. 用于操作一组对象的聚集imp 阅读全文
posted @ 2008-05-22 05:56 shine_panda 阅读(936) 评论(0) 推荐(0) 编辑
摘要: <!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><head><metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/> 阅读全文
posted @ 2008-05-20 07:28 shine_panda 阅读(177) 评论(0) 推荐(0) 编辑
摘要: importjava.io.*;importcom.sun.image.codec.jpeg.*;importjava.awt.*;importjava.awt.image.BufferedImage;importjava.awt.image.*;importjavax.swing.*;publicclassTest...{publicstaticvoidmain(String[]args)throwsException...{//1.jpg是你的主图片的路径InputStreamis=newFileInputStream("1.jpg");//通过JPEG图象流创建JPE 阅读全文
posted @ 2008-05-19 20:22 shine_panda 阅读(9004) 评论(0) 推荐(0) 编辑
摘要: voidpaixu(inta[],intlow,inthigh;)//用快速排序法...{ //low,high表示扫描的范围 intpivot;//存放中心索引及其值的局部变量 intscanup,scandown,mid;//用于扫描的索引 if(high-low<=0)//如果数组中的元素少于两个,则返回 return; else if(high-low==1)//如果有两个元素,对其进行比较 ...{ if(apai[high]<apai[low])//如果后一个比前一个小, Swap(apai[low],apai[high]);//那么交换位置 return; ... 阅读全文
posted @ 2008-05-19 08:07 shine_panda 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 参考: think in java//定义一个接口interfaceIncrementable...{voidincrement();}//一个简单的接口实现类classCallee1implementsIncrementable...{privateinti=0;publicvoidincrement()...{i++;System.out.println(i);}}classMyIncrement...{voidincrement()...{System.out.println("otheroperator");}staticvoidf(MyIncrementmi).. 阅读全文
posted @ 2008-05-18 20:46 shine_panda 阅读(236) 评论(0) 推荐(0) 编辑
摘要: importjava.util.*;publicclassTest...{publicstaticvoidmain(String[]args)...{//生成[0-n)个不重复的随机数//list用来保存这些随机数ArrayListlist=newArrayList();intn=10;Randomrand=newRandom();boolean[]bool=newboolean[n];intnum=0;for(inti=0;i<n;i++)...{do...{//如果产生的数相同继续循环num=rand.nextInt(n);}while(bool[num]);bool[num]=tr 阅读全文
posted @ 2008-05-16 09:33 shine_panda 阅读(1051) 评论(0) 推荐(0) 编辑
摘要: 学习spring 之前java中的几个模式是很重要的 其中一个就是代理模式。下面用几个简单的例子来理解一下这个模式。以及它的应用。1,普通的代理模式。classHouse...{privatefloatprice=200f;publicfloatgetPrice()...{returnprice;}publicvoidsetPrice()...{this.price=price;}}//房东classHouseOwner...{Househouse=null;HouseOwner(Househouse)...{this.house=house;}publicvoidrent()...{Syst 阅读全文
posted @ 2008-05-16 06:14 shine_panda 阅读(164) 评论(0) 推荐(0) 编辑
摘要: eclipse:Ctrl+shift+F Eclipse快捷键指南 本文档从Eclipse软件上整理,是列出了标准的快捷键,未列出Emacs快捷键。 编辑 作用域功能快捷键 全局查找并替换Ctrl+F 文本编辑器查找上一个Ctrl+Shift+K 文本编辑器查找下一个Ctrl+K 全局撤销Ctrl+Z 全局复制Ctrl+C 全局恢复上一个选择Alt+Shift+↓ 全局剪切Ctrl+X 全局快速修正Ctrl1+1 全局内容辅助Alt+/ 全局全部选中Ctrl+A 全局删除Delete 全局上下文信息Alt+? Alt+Shift+? Ctrl+Shift+Space Java编辑器显示工具提. 阅读全文
posted @ 2008-05-15 08:41 shine_panda 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 学程序大多是从HelloWorld开始 . 自己也是通过参考书看了这个例子 加上自己的一点体会. 来理解Spring 的核心在Hello World的例子中我们有两个角色 1, 消息提供者 ,2,消息显示者. 通过分离她们的职责我们来理解Spring的 DItemp.propertiesdisplayer = ConcreteMessageDisplayersupplier = HelloWorldMessageSupplierMessageSupplier.javapublic interface MessageSupplier{//取得消息String getMessage();}Mess 阅读全文
posted @ 2008-05-15 07:49 shine_panda 阅读(126) 评论(0) 推荐(0) 编辑
摘要: Java基础方面:0、作用域public,private,protected,以及不写时的区别答:区别如下:作用域 当前类 同一package 子孙类 其他packagepublic √ √ √ √protected √ √ √ ×friendly √ √ × ×private √ × × ×不写时默认为friendly1。java.lang.String类是final类型的,因此不可以继承这个类、不能修改这个类。为了提高效率节省空间,我们应该用StringBuffer类3、int 和 Integer 有什么区别Java 提供两种不同 阅读全文
posted @ 2008-05-14 12:45 shine_panda 阅读(193) 评论(0) 推荐(0) 编辑