<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>

<channel>
	<title>IdeaGrace博客</title>
	<atom:link href="http://www.ideagrace.com/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.ideagrace.com/blog</link>
	<description>Web开发者日志  自强不息</description>
	<pubDate>Tue, 24 Aug 2010 13:57:00 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>如何完成Apache虚拟主机设置？</title>
		<link>http://www.ideagrace.com/blog/?p=457</link>
		<comments>http://www.ideagrace.com/blog/?p=457#comments</comments>
		<pubDate>Tue, 24 Aug 2010 13:57:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[电脑技术]]></category>

		<category><![CDATA[apache]]></category>

		<guid isPermaLink="false">http://www.ideagrace.com/blog/?p=457</guid>
		<description><![CDATA[实现Apache虚拟主机方法一:
开启虚拟主机配置文件
对httpd.conf进行设置：
1.注释以下三行
#ServerAdmin
#ServerName
#DocumentRoot
2．去掉mod_proxy.so和mod_proxy_ajp.so的注释
3．#Virtual hosts
#Include conf/extra/httpd-vho... ]]></description>
			<content:encoded><![CDATA[<p>实现Apache虚拟主机方法一:<br />
开启虚拟主机配置文件</p>
<p>对httpd.conf进行设置：</p>
<p>1.注释以下三行</p>
<p>#ServerAdmin<br />
#ServerName<br />
#DocumentRoot</p>
<p>2．去掉mod_proxy.so和mod_proxy_ajp.so的注释</p>
<p>3．#Virtual hosts</p>
<p>#Include conf/extra/httpd-vhosts.conf （查找这行，把前面的＃去掉）<br />
/conf/extra/httpd-vhosts.conf</p>
<p>4．打开　/conf/extra/httpd-vhosts.conf</p>
<p>#192.168.1.24为本地Ip<br />
NameVirtualHost 192.168.1.24:80</p>
<p># php项目</p>
<p><VirtualHost 192.168.1.24:80></p>
<p><Directory "D:/phproot/phpmyadmin"></p>
<p>DirectoryIndex index.php</p>
<p></Directory></p>
<p>ServerAdmin baibiao @gmail.com</p>
<p>ServerName email.sinoepiboly.com</p>
<p>#ServerAlias email.sinoepiboly.com</p>
<p>DocumentRoot D:/phproot/phpmyadmin</p>
<p></VirtualHost></p>
<p>==================================================================</p>
<p>方法二:</p>
<p>多二级域名主机开发环境设置说明<br />
第一步 DNS解析实现</p>
<p>找到本机的host文件，一般在 C:\WINNT\system32\drivers\etc，在文件结尾添加：</p>
<p>127.0.0.1 localhost<br />
127.0.0.1 www.com.cn<br />
127.0.0.1 home.com.cn<br />
127.0.0.1 mail.com.cn<br />
127.0.0.1 music.com.cn<br />
127.0.0.1 browseusers.com.cn<br />
127.0.0.1 search.com.cn<br />
127.0.0.1 invite.com.cn<br />
127.0.0.1 rank.com.cn<br />
127.0.0.1 blog.com.cn<br />
127.0.0.1 favorites.com.cn<br />
127.0.0.1 forum.com.cn<br />
127.0.0.1 groups.com.cn<br />
127.0.0.1 events.com.cn<br />
127.0.0.1 classifieds.com.cn<br />
127.0.0.1 signup.com.cn<br />
192.168.6.153 i.com.cn<br />
192.168.6.153 x.com.cn</p>
<p>其中<br />
192.168.6.2 i.com.cn<br />
192.168.6.2 x.com.cn<br />
技术人员不作修改，是美工页面专用的</p>
<p>第二步：apache 设置</p>
<p>打开httpd.conf，以music.com.cn为例，其他栏目类似添加,在文件最后加入:</p>
<p>1. 保证<br />
Listen 80</p>
<p>2. 打开注释<br />
NameVirtualHost *:80</p>
<p>3. 在末尾添加<br />
<VirtualHost *:80><br />
ServerAdmin x_cn@msn.com<br />
DocumentRoot &#8220;C:/Program Files/Apache Group/Apache2/htdocs/espace/music&#8221;<br />
ServerName music.com.cn<br />
</VirtualHost><br />
<VirtualHost *:80><br />
ServerAdmin x_cn@msn.com<br />
DocumentRoot &#8220;C:/Program Files/Apache Group/Apache2/htdocs/espace/blog&#8221;<br />
ServerName blog.com.cn<br />
</VirtualHost></p>
<p>&#8230;</p>
<p>重启即可,Apache虚拟主机设置完成。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ideagrace.com/blog/?feed=rss2&amp;p=457</wfw:commentRss>
		</item>
		<item>
		<title>信用卡卡号验证码验证位的核对演算法</title>
		<link>http://www.ideagrace.com/blog/?p=455</link>
		<comments>http://www.ideagrace.com/blog/?p=455#comments</comments>
		<pubDate>Wed, 30 Jun 2010 13:49:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[电脑技术]]></category>

		<guid isPermaLink="false">http://www.ideagrace.com/blog/?p=455</guid>
		<description><![CDATA[首先声明：仅供学习，请勿用于其他用途。
其次声明：转载文章，原文地址：http://www.oreilly.com.tw /product_security.php?id=a052_sample
信用卡号的最后一个数字，就是输入过程中用来检验卡号是否正确... ]]></description>
			<content:encoded><![CDATA[<p>首先声明：仅供学习，请勿用于其他用途。</p>
<p>其次声明：转载文章，原文地址：http://www.oreilly.com.tw /product_security.php?id=a052_sample</p>
<p>信用卡号的最后一个数字，就是输入过程中用来检验卡号是否正确时，所使用的核对数字。虽然此核对演算法早已公开（ISO 2894），但是目前还是很多人并不清楚它的作法。</p>
<p>信用卡号的最后一个数字，就是输入过程中用来检验卡号是否正确时，所使用的核对数字。虽然此核对演算法早已公开（ISO 2894），但是目前还是很多人并不清楚它的作法。</p>
<p>演算法执行过程如下：</p>
<p>    1.将卡号上的每个数字乘上其权重（weight），如果卡号上的数字个数是偶数，那么第一个数字的权重就是2，若是奇数，那么权重就给1，剩下来的数 字，根据第一个数字依序给定。例如某信用卡卡号的数字个数为偶数，那么从第一位数字开始的权重依序为2、1、2、1、2、1 &#8230;。<br />
    2.如果数字乘上自己的权重后比9还大，那么就从这加权数字里扣除9。<br />
    3.接下来将所有处理过的加权数字全部加总起来，并且除以10，取其余数。<br />
    4.此余数应该是0，否则就可能是输入过程有误，也有可能信用卡号是假的。</p>
<p>这样的算法可以用来检验数字输入过程中可能发生的数字调换、位移等等输入错误。此外这种算法也可以用在其它方面，当作安全装置来使用【注】。如果我们把算法写成Perl程式的话，便如下所示：</p>
<p>【注】让我们担心的是，某些商家竟使用此演算法当作是检验信用卡正确性的低价方法。然而此方法只能告诉我们卡号输入过程是否错误发生，却无法确切告诉我们信用卡的正确性。只要有心人蓄意造假，业者很可能遭受严重的损失。</p>
<p>sub validate_cc {<br />
     local ($cc) = $_[0];<br />
     local ($digit,$sum,$val);<br />
     local ($weight) = 1;</p>
<p>     $weight = 2 if (length($cc) %2 ==0);</p>
<p>     while($cc ne &#8220;&#8221;){<br />
             $digit = substr($cc,0,1);<br />
             $cc = substr($cc,1);<br />
             $val = $digit * $weight;<br />
             $val-=9 if ($val>9);<br />
             $sum += $val;<br />
             $weight = ($weight==2) ? 1 : 2;</p>
<p>     }<br />
     return ($sum % 10) == 0;</p>
<p>}</p>
<p>现在我们举一个实例来看看（读者也可以使用你信用卡号上的数字来试试看）。这是Simson所持有的美国运通卡号码：3728 024906 54059。</p>
<p>卡号上共有15个数字。所以第一个数字的权重为1，全部的权重分别是1、2、1、2、1、2、1、2、1、2、1、2、1、2、1。我们将每个数字分别乘上它的权重：</p>
<p>(3 x 1) , (7 x 2) , (2 x 1) , (8 x 2) , (0 x 1) , (2 x 2) , (4 x 1) , (9 x 2) ,</p>
<p>(0 x 1) , (6 x 2) , (5 x 1) , (4 x 2) , (0 x 1) , (5 x 2) , (9 x 1)</p>
<p>得到它们个别的加权值：</p>
<p>(3) , (14) , (2) , (16) , (0) , (4) , (4) , (18) ,</p>
<p>(0) , (12) , (5) , (8) , (0) , (10) , (9)</p>
<p>将所有大于9的加权值扣除9，然后相加：</p>
<p>(3) + (5) + (2) + (7) + (0) + (4) + (4) + (9) +</p>
<p>(0) + (3) + (5) + (8) + (0) + (1) + (9) = 60</p>
<p>最后将所有值相加，并且除以10，我们所得到的结果果然是0。</p>
<p>60 mod 10 = 0</p>
<p>请注意：千万别冒用Simson的信用卡帐号。冒用信用卡是条重罪。</p>
<p>信用卡交易核对单</p>
<p>信用卡交易核对单可以让我们清楚知道当次的交易讯息。在过去某段时间内，它都是使用纸条来进行记录，并且在每次信用交易之后必须拿给客户核对。渐 渐地服务商发觉使用纸条的费用过高，不够经济，所以在1970年代中期，Visa与MasterCard改变原有运作方式，每个月将信用交易资料总结后， 才把核对单送回给客户以供核对使用。 1980年代，美国运通公司开始将所有核对单资料数位化，并将交易讯息列印出来送回给客户进行确认。现在，客户已经很难见到最原始的核对单了。</p>
<p>随着时间推移，交易核对单上的资讯也持续地增加中。下面所列出的要项是核单资料 不可漏缺的部分：</p>
<p>     *客户姓名<br />
     *客户的信用卡号码<br />
     *客户的住址<br />
     *客户编号<br />
     *交易日期<br />
     *交易金额<br />
     *商品或是服务的种类<br />
     *单据号码<br />
     *授权代码<br />
     *销售商的名称</p>
<p>虽然过去20年来，电脑已经逐渐取代传统的文件作业方式，但是原有的文件内容我们仍须完整保留下来，因为这些文件资料有很重要的价值，它们能够协助我们调查过去的交易记录，并且提供我们信用诈欺事件的线索。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ideagrace.com/blog/?feed=rss2&amp;p=455</wfw:commentRss>
		</item>
		<item>
		<title>在godaddy和yahoo用paypal注册域名的同学防误扣款必知</title>
		<link>http://www.ideagrace.com/blog/?p=453</link>
		<comments>http://www.ideagrace.com/blog/?p=453#comments</comments>
		<pubDate>Sat, 26 Jun 2010 14:44:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[电脑技术]]></category>

		<category><![CDATA[domain]]></category>

		<guid isPermaLink="false">http://www.ideagrace.com/blog/?p=453</guid>
		<description><![CDATA[
	虽然godaddy已经支持支付宝注册，但是还是有些同学在用paypal支付，且有可能在支持支付宝已经用paypal注册了；另外yahoo一 直以来就有的$1.99首年注册.com的优惠，估计也有不少同学在那注册过... ]]></description>
			<content:encoded><![CDATA[<p>
	虽然godaddy已经支持支付宝注册，但是还是有些同学在用paypal支付，且有可能在支持支付宝已经用paypal注册了；另外yahoo一 直以来就有的$1.99首年注册.com的优惠，估计也有不少同学在那注册过了吧，但是续费比较贵，$35每年。</p>
<p>
	为什么单说这两家呢，因为这两家的结算协议有些特别，就是你在注册时已经同意了自动续费，为了防止&ldquo;被&rdquo;续费，需要取消这个协议，以下说下步骤：</p>
<p>
	登陆你的paypal帐户，找到用户信息，财务信息分栏里找到&ldquo;我的预核准付款&rdquo;，如下图所示：</p>
<p>
	<a href="http://www.kuaizhuan.info/wp-content/uploads/2010/05/paypal.jpg" onclick="javascript:pageTracker._trackPageview('/downloads/wp-content/uploads/2010/05/paypal.jpg');"><img alt="paypal" border="0" height="465" src="http://www.kuaizhuan.info/wp-content/uploads/2010/05/paypal_thumb.jpg" style="border: 0px none; display: inline;" title="paypal" width="855" /></a></p>
<p>
	点击进入后，就会看到当前所有有自动付款协议的商家，点击那个协议取消即可</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ideagrace.com/blog/?feed=rss2&amp;p=453</wfw:commentRss>
		</item>
		<item>
		<title>一道面试题</title>
		<link>http://www.ideagrace.com/blog/?p=452</link>
		<comments>http://www.ideagrace.com/blog/?p=452#comments</comments>
		<pubDate>Mon, 07 Jun 2010 01:30:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[电脑技术]]></category>

		<guid isPermaLink="false">http://www.ideagrace.com/blog/?p=452</guid>
		<description><![CDATA[传说，从前有五个海盗抢得了100枚金币.他们通过了一个如何确定选用谁的分配方案的安排.即:
1.抽签决定各人的号码（1，2，3，4，5）；
2. 先由1号提出分配方案，然后5个人表决.当且仅当超过... ]]></description>
			<content:encoded><![CDATA[<p>传说，从前有五个海盗抢得了100枚金币.他们通过了一个如何确定选用谁的分配方案的安排.即:<br />
1.抽签决定各人的号码（1，2，3，4，5）；<br />
2. 先由1号提出分配方案，然后5个人表决.当且仅当超过半数人同意时，方案才算被通过，否则他将被扔入大海喂鲨鱼；<br />
3.当1号死后，再由2号提方案，4个人表决，当且仅当超过半数同意时，方案才算通过，否则2号同样将被扔入大海喂鲨鱼；<br />
4.往下依次类推;<br />
根据上面的这个故事，现在提出如下的一个问题.即：<br />
我们假定每个海盗都是很聪明的人，并且都能够很理智地判断自己的得失，从而做出最佳的选择，<br />
那么第一个海盗应当提出怎样的分配方案才能够使自己不被扔入大海喂鲨鱼，而且收益还能达到最大化呢？</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ideagrace.com/blog/?feed=rss2&amp;p=452</wfw:commentRss>
		</item>
		<item>
		<title>二叉树的创建、前序遍历、中序遍历、后序遍历</title>
		<link>http://www.ideagrace.com/blog/?p=450</link>
		<comments>http://www.ideagrace.com/blog/?p=450#comments</comments>
		<pubDate>Sat, 22 May 2010 02:08:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[电脑技术]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[数据结构]]></category>

		<guid isPermaLink="false">http://www.ideagrace.com/blog/?p=450</guid>
		<description><![CDATA[
	经常考的数据结构题目。

	package tree;
	public class Tree {
	&#160;&#160;&#160; private int data;// 数据节点
	&#160;&#160;&#160; private Tree left;// 左子树
	&#160;&#160;&#160; private Tree right;// 右子树
	&#160;&#160;&#160; publi... ]]></description>
			<content:encoded><![CDATA[<p>
	经常考的数据结构题目。</p>
<p>
	package tree;</p>
<p>	public class Tree {</p>
<p>	&nbsp;&nbsp;&nbsp; private int data;// 数据节点<br />
	&nbsp;&nbsp;&nbsp; private Tree left;// 左子树<br />
	&nbsp;&nbsp;&nbsp; private Tree right;// 右子树</p>
<p>	&nbsp;&nbsp;&nbsp; public Tree(int data) {<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; this.data = data;<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; this.left = null;<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; this.right = null;<br />
	&nbsp;&nbsp;&nbsp; }</p>
<p>	&nbsp;&nbsp;&nbsp; /**<br />
	&nbsp;&nbsp;&nbsp; &nbsp;* 创建二叉树，返回根结点<br />
	&nbsp;&nbsp;&nbsp; &nbsp;* <br />
	&nbsp;&nbsp;&nbsp; &nbsp;* @param input<br />
	&nbsp;&nbsp;&nbsp; &nbsp;* @return<br />
	&nbsp;&nbsp;&nbsp; &nbsp;*/<br />
	&nbsp;&nbsp;&nbsp; public static Tree createTree(int[] input) {<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Tree root = null;<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Tree temp = null;<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; input.length; i++) {<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // 创建根节点<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (root == null) {<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; root = temp = new Tree(input[i]);<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } else {<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // 回到根结点<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; temp = root;<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // 添加节点<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; while (temp.data != input[i]) {<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (input[i] &lt;= temp.data) {<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (temp.left != null) {<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; temp = temp.left;<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } else {<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; temp.left = new Tree(input[i]);<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } else {<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (temp.right != null) {<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; temp = temp.right;<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } else {<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; temp.right = new Tree(input[i]);<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return root;<br />
	&nbsp;&nbsp;&nbsp; }</p>
<p>	&nbsp;&nbsp;&nbsp; /**<br />
	&nbsp;&nbsp;&nbsp; &nbsp;* 前序遍历<br />
	&nbsp;&nbsp;&nbsp; &nbsp;* <br />
	&nbsp;&nbsp;&nbsp; &nbsp;* @param tree<br />
	&nbsp;&nbsp;&nbsp; &nbsp;*/<br />
	&nbsp;&nbsp;&nbsp; public static void preOrder(Tree tree) {<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (tree != null) {<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.out.print(tree.data + &quot; &quot;);<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; preOrder(tree.left);<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; preOrder(tree.right);<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
	&nbsp;&nbsp;&nbsp; }</p>
<p>	&nbsp;&nbsp;&nbsp; /**<br />
	&nbsp;&nbsp;&nbsp; &nbsp;* 中序遍历<br />
	&nbsp;&nbsp;&nbsp; &nbsp;* <br />
	&nbsp;&nbsp;&nbsp; &nbsp;* @param tree<br />
	&nbsp;&nbsp;&nbsp; &nbsp;*/<br />
	&nbsp;&nbsp;&nbsp; public static void midOrder(Tree tree) {<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (tree != null) {<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; midOrder(tree.left);<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.out.print(tree.data + &quot; &quot;);<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; midOrder(tree.right);<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
	&nbsp;&nbsp;&nbsp; }</p>
<p>	&nbsp;&nbsp;&nbsp; /**<br />
	&nbsp;&nbsp;&nbsp; &nbsp;* 后序遍历<br />
	&nbsp;&nbsp;&nbsp; &nbsp;* <br />
	&nbsp;&nbsp;&nbsp; &nbsp;* @param tree<br />
	&nbsp;&nbsp;&nbsp; &nbsp;*/<br />
	&nbsp;&nbsp;&nbsp; public static void posOrder(Tree tree) {<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (tree != null) {<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; posOrder(tree.left);<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; posOrder(tree.right);<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.out.print(tree.data + &quot; &quot;);<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
	&nbsp;&nbsp;&nbsp; }</p>
<p>	&nbsp;&nbsp;&nbsp; /**<br />
	&nbsp;&nbsp;&nbsp; &nbsp;* @param args<br />
	&nbsp;&nbsp;&nbsp; &nbsp;*/<br />
	&nbsp;&nbsp;&nbsp; public static void main(String[] args) {<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int[] input = { 4, 2, 6, 1, 3, 5, 7 };<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Tree tree = createTree(input);<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.out.print(&quot;前序遍历：&quot;);<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; preOrder(tree);<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.out.print(&quot;\n 中序遍历：&quot;);<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; midOrder(tree);<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.out.print(&quot;\n 后序遍历：&quot;);<br />
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; posOrder(tree);<br />
	&nbsp;&nbsp;&nbsp; }<br />
	}<br />
	&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ideagrace.com/blog/?feed=rss2&amp;p=450</wfw:commentRss>
		</item>
		<item>
		<title>泛型  详解</title>
		<link>http://www.ideagrace.com/blog/?p=448</link>
		<comments>http://www.ideagrace.com/blog/?p=448#comments</comments>
		<pubDate>Thu, 13 May 2010 09:20:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[电脑技术]]></category>

		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.ideagrace.com/blog/?p=448</guid>
		<description><![CDATA[
	关键字: 泛型 &#60;t&#62; 详解

	&#160;引用。原地址：http://www.java3z.com/cwbwebhome/article/article5/tiger2.jsp

	清单 1
	// 一个简单的范型类.&#160; 
	// 这里,T 是一个类型参数,当创建Gen类的对象时将被真实的... ]]></description>
			<content:encoded><![CDATA[<p>
	关键字: 泛型 &lt;t&gt; 详解</p>
<p>
	<font>&nbsp;引用。原地址：<font>http://www.java3z.com/cwbwebhome/article/article5/tiger2.jsp</font></font></p>
<p>
	<font>清单 1<br />
	// 一个简单的范型类.&nbsp; <br />
	// 这里,T 是一个类型参数,当创建Gen类的对象时将被真实的类型取代. <br />
	public class Gen&lt; T&gt; { <br />
	&nbsp; T ob; // 声明一个T类型的对象 <br />
	&nbsp;&nbsp; </p>
<p>	&nbsp; Gen(T o) { <br />
	&nbsp;&nbsp;&nbsp; ob = o; <br />
	&nbsp; } </p>
<p>
	&nbsp; public T getob() { <br />
	&nbsp;&nbsp;&nbsp; return ob; <br />
	&nbsp; } </p>
<p>	&nbsp; // 输出T的类型<br />
	public&nbsp; void showType() { <br />
	&nbsp;&nbsp;&nbsp; System.out.println(&quot;Type of T is &quot; + <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ob.getClass().getName()); <br />
	&nbsp; } <br />
	} </p>
<p>	// 示范这个范型类的用法<br />
	public class GenDemo { <br />
	&nbsp; public static void main(String args[]) { <br />
	&nbsp;&nbsp;&nbsp; // 声明一个类型参数为Integers的Gen对象&nbsp; <br />
	&nbsp;&nbsp;&nbsp; Gen&lt; Integer&gt; iOb;&nbsp; </p>
<p>	&nbsp;&nbsp;&nbsp; // 创建一个Gen&lt; Integer&gt; 对象并分配其引用到iOb.&nbsp; 注意使用了自动装箱. <br />
	&nbsp;&nbsp;&nbsp; iOb = new Gen&lt; Integer&gt;(88); </p>
<p>	&nbsp;&nbsp;&nbsp; // 显示类型 <br />
	&nbsp;&nbsp;&nbsp; iOb.showType(); </p>
<p>	&nbsp;&nbsp;&nbsp; // 获取在iOb对象内的值,注意不需要类型转换.<br />
	&nbsp; <br />
	&nbsp;&nbsp;&nbsp; int v = iOb.getob(); <br />
	&nbsp;&nbsp;&nbsp; System.out.println(&quot;value: &quot; + v); </p>
<p>	&nbsp;&nbsp;&nbsp; System.out.println(); </p>
<p>	&nbsp;&nbsp;&nbsp; // 创建一个类型参数为String的Gen对象<br />
	&nbsp;&nbsp;&nbsp; Gen&lt; String&gt; strOb = new Gen&lt; String&gt;(&quot;Generics Test&quot;); </p>
<p>	&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp; strOb.showType(); </p>
<p>	&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp; String str = strOb.getob(); <br />
	&nbsp;&nbsp;&nbsp; System.out.println(&quot;value: &quot; + str); <br />
	&nbsp; } <br />
	}</p>
<p>	清单2<br />
	// NonGen类没有使用范型, 与使用范型的Gen的等价 <br />
	class NonGen {&nbsp; <br />
	&nbsp; Object ob; // ob 现在是一个Object类型<br />
	&nbsp;&nbsp;&nbsp; <br />
	&nbsp; <br />
	&nbsp; NonGen(Object o) {&nbsp; <br />
	&nbsp;&nbsp;&nbsp; ob = o;&nbsp; <br />
	&nbsp; }&nbsp; <br />
	&nbsp; <br />
	&nbsp; // 返回类型为 Object. <br />
	&nbsp; Object getob() {&nbsp; <br />
	&nbsp;&nbsp;&nbsp; return ob;&nbsp; <br />
	&nbsp; }&nbsp; </p>
<p>	&nbsp; // 显示ob的类型.&nbsp; <br />
	&nbsp; void showType() {&nbsp; <br />
	&nbsp;&nbsp;&nbsp; System.out.println(&quot;Type of ob is &quot; +&nbsp; <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ob.getClass().getName());&nbsp; <br />
	&nbsp; }&nbsp; <br />
	}&nbsp; <br />
	&nbsp; <br />
	// 示范这个类用使用.&nbsp; <br />
	class NonGenDemo {&nbsp; <br />
	&nbsp; public static void main(String args[]) {&nbsp; <br />
	&nbsp;&nbsp;&nbsp; NonGen iOb;&nbsp;&nbsp; <br />
	&nbsp; <br />
	&nbsp;&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp; // 自动装箱还会发生. <br />
	&nbsp;&nbsp;&nbsp; iOb = new NonGen(88);&nbsp; <br />
	&nbsp; <br />
	&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp; iOb.showType(); </p>
<p>	&nbsp;&nbsp;&nbsp; // 输出iOb的值,必须进行类型转换 <br />
	&nbsp;&nbsp;&nbsp; int v = (Integer) iOb.getob();&nbsp; <br />
	&nbsp;&nbsp;&nbsp; System.out.println(&quot;value: &quot; + v);&nbsp; <br />
	&nbsp; <br />
	&nbsp;&nbsp;&nbsp; System.out.println();&nbsp; <br />
	&nbsp; </p>
<p>	&nbsp;&nbsp;&nbsp; // 创建另一个对象,存字符串. <br />
	&nbsp;&nbsp;&nbsp; NonGen strOb = new NonGen(&quot;Non-Generics Test&quot;);&nbsp; <br />
	&nbsp; <br />
	&nbsp;&nbsp;&nbsp; strOb.showType(); </p>
<p>	&nbsp;&nbsp;&nbsp; String str = (String) strOb.getob();&nbsp; <br />
	&nbsp;&nbsp;&nbsp; System.out.println(&quot;value: &quot; + str);&nbsp; </p>
<p>	&nbsp;&nbsp;&nbsp; // 下面这句编译能通过,因为没有语法错误 <br />
	&nbsp;&nbsp;&nbsp; iOb = strOb; <br />
	&nbsp;&nbsp;&nbsp; v = (Integer) iOb.getob(); // 发生运行时错误! <br />
	&nbsp; }&nbsp; <br />
	}</p>
<p>	清单 3<br />
	//带两个类型参数的范型 <br />
	class TwoGen&lt; T, V&gt; { <br />
	&nbsp; T ob1; <br />
	&nbsp; V ob2; <br />
	&nbsp;&nbsp; </p>
<p>	&nbsp; TwoGen(T o1, V o2) { <br />
	&nbsp;&nbsp;&nbsp; ob1 = o1; <br />
	&nbsp;&nbsp;&nbsp; ob2 = o2; <br />
	&nbsp; } </p>
<p>	&nbsp; // 显示T 和 V的类型. <br />
	&nbsp; void showTypes() { <br />
	&nbsp;&nbsp;&nbsp; System.out.println(&quot;Type of T is &quot; + <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ob1.getClass().getName()); </p>
<p>	&nbsp;&nbsp;&nbsp; System.out.println(&quot;Type of V is &quot; + <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ob2.getClass().getName()); <br />
	&nbsp; } </p>
<p>	&nbsp; T getob1() { <br />
	&nbsp;&nbsp;&nbsp; return ob1; <br />
	&nbsp; } </p>
<p>	&nbsp; V getob2() { <br />
	&nbsp;&nbsp;&nbsp; return ob2; <br />
	&nbsp; } <br />
	} </p>
<p>	// 示范. <br />
	class SimpGen { <br />
	&nbsp; public static void main(String args[]) { </p>
<p>	&nbsp;&nbsp;&nbsp; TwoGen&lt; Integer, String&gt; tgObj =<br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new TwoGen&lt; Integer, String&gt;(88, &quot;Generics&quot;); </p>
<p>	&nbsp;&nbsp;&nbsp; tgObj.showTypes(); </p>
<p>	&nbsp;&nbsp;&nbsp; // 获取并显示值. <br />
	&nbsp;&nbsp;&nbsp; int v = tgObj.getob1(); <br />
	&nbsp;&nbsp;&nbsp; System.out.println(&quot;value: &quot; + v); </p>
<p>	&nbsp;&nbsp;&nbsp; String str = tgObj.getob2(); <br />
	&nbsp;&nbsp;&nbsp; System.out.println(&quot;value: &quot; + str); <br />
	&nbsp; } <br />
	}</p>
<p>	清单 4<br />
	// 尝试创建一个能计算数字平均值的泛型类<br />
	// 这个类包括一个错误! <br />
	class Stats&lt; T&gt; {&nbsp; <br />
	&nbsp; T[] nums; // nums 是一个T类型的数组 <br />
	&nbsp;&nbsp;&nbsp; <br />
	&nbsp; <br />
	&nbsp; Stats(T[] o) {&nbsp; <br />
	&nbsp;&nbsp;&nbsp; nums = o;&nbsp; <br />
	&nbsp; }&nbsp; <br />
	&nbsp; <br />
	&nbsp; // 所有的情况下都返回double. <br />
	&nbsp; double average() {&nbsp; <br />
	&nbsp;&nbsp;&nbsp; double sum = 0.0; </p>
<p>	&nbsp;&nbsp;&nbsp; for(int i=0; i &lt; nums.length; i++)&nbsp; <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sum += nums[i].doubleValue(); // 错误!!!,编译器无法知道你只使用数字类型创建Stats对象.</p>
<p>	&nbsp;&nbsp;&nbsp; return sum / nums.length; <br />
	&nbsp; }&nbsp; <br />
	}</p>
<p>	清单 5<br />
	// 这次使用有界类型的范型,声明一个上界,所有类型变量必须从超类派生. <br />
	class Stats&lt; T extends Number&gt; {&nbsp; <br />
	&nbsp; T[] nums; // Number或它的子类型的数组 <br />
	&nbsp;&nbsp;&nbsp; </p>
<p>	&nbsp; Stats(T[] o) {&nbsp; <br />
	&nbsp;&nbsp;&nbsp; nums = o;&nbsp; <br />
	&nbsp; }&nbsp; <br />
	&nbsp; <br />
	&nbsp; double average() {&nbsp; <br />
	&nbsp;&nbsp;&nbsp; double sum = 0.0; </p>
<p>	&nbsp;&nbsp;&nbsp; for(int i=0; i &lt; nums.length; i++)&nbsp; <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sum += nums[i].doubleValue(); </p>
<p>	&nbsp;&nbsp;&nbsp; return sum / nums.length; <br />
	&nbsp; }&nbsp; <br />
	}&nbsp; <br />
	&nbsp; <br />
	// 示范&nbsp; <br />
	class BoundsDemo {&nbsp; <br />
	&nbsp; public static void main(String args[]) {&nbsp; </p>
<p>	&nbsp;&nbsp;&nbsp; Integer inums[] = { 1, 2, 3, 4, 5 }; <br />
	&nbsp;&nbsp;&nbsp; Stats&lt; Integer&gt; iob = new Stats&lt; Integer&gt;(inums);&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp; double v = iob.average(); <br />
	&nbsp;&nbsp;&nbsp; System.out.println(&quot;iob average is &quot; + v); </p>
<p>	&nbsp;&nbsp;&nbsp; Double dnums[] = { 1.1, 2.2, 3.3, 4.4, 5.5 }; <br />
	&nbsp;&nbsp;&nbsp; Stats&lt; Double&gt; dob = new Stats&lt; Double&gt;(dnums);&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp; double w = dob.average(); <br />
	&nbsp;&nbsp;&nbsp; System.out.println(&quot;dob average is &quot; + w); </p>
<p>	&nbsp;&nbsp;&nbsp; // 这不能编译,因为String不是Number的子类<br />
	&nbsp;&nbsp;&nbsp; // String strs[] = { &quot;1&quot;, &quot;2&quot;, &quot;3&quot;, &quot;4&quot;, &quot;5&quot; }; <br />
	&nbsp;&nbsp;&nbsp; // Stats&lt; String&gt; strob = new Stats&lt; String&gt;(strs);&nbsp;&nbsp; <br />
	&nbsp; <br />
	&nbsp;&nbsp;&nbsp; // double x = strob.average(); <br />
	&nbsp;&nbsp;&nbsp; // System.out.println(&quot;strob average is &quot; + v); </p>
<p>	&nbsp; }&nbsp; <br />
	}</p>
<p>	清单 6<br />
	// 使用通配符 <br />
	class Stats&lt; T extends Number&gt; {&nbsp;&nbsp; <br />
	&nbsp; T[] nums; <br />
	&nbsp;&nbsp;&nbsp;&nbsp; <br />
	&nbsp; <br />
	&nbsp; Stats(T[] o) {&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp; nums = o;&nbsp;&nbsp; <br />
	&nbsp; }&nbsp;&nbsp; <br />
	&nbsp;&nbsp; <br />
	&nbsp; double average() {&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp; double sum = 0.0;&nbsp; <br />
	&nbsp; <br />
	&nbsp;&nbsp;&nbsp; for(int i=0; i &lt; nums.length; i++)&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sum += nums[i].doubleValue();&nbsp; <br />
	&nbsp; <br />
	&nbsp;&nbsp;&nbsp; return sum / nums.length;&nbsp; <br />
	&nbsp; } </p>
<p>	&nbsp; // 确定两个包含数组的Stats对象是否有相同的平均值. <br />
	&nbsp; // 注意使用通配符<br />
	&nbsp; boolean sameAvg(Stats&lt; ?&gt; ob) { <br />
	&nbsp;&nbsp;&nbsp; if(average() == ob.average())&nbsp; <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return true; </p>
<p>	&nbsp;&nbsp;&nbsp; return false; <br />
	&nbsp; } <br />
	}&nbsp;&nbsp; <br />
	&nbsp;&nbsp; <br />
	// 示范. <br />
	class WildcardDemo {&nbsp;&nbsp; <br />
	&nbsp; public static void main(String args[]) {&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp; Integer inums[] = { 1, 2, 3, 4, 5 };&nbsp; <br />
	&nbsp;&nbsp;&nbsp; Stats&lt; Integer&gt; iob = new Stats&lt; Integer&gt;(inums);&nbsp;&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp; double v = iob.average();&nbsp; <br />
	&nbsp;&nbsp;&nbsp; System.out.println(&quot;iob average is &quot; + v);&nbsp; <br />
	&nbsp; <br />
	&nbsp;&nbsp;&nbsp; Double dnums[] = { 1.1, 2.2, 3.3, 4.4, 5.5 };&nbsp; <br />
	&nbsp;&nbsp;&nbsp; Stats&lt; Double&gt; dob = new Stats&lt; Double&gt;(dnums);&nbsp;&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp; double w = dob.average();&nbsp; <br />
	&nbsp;&nbsp;&nbsp; System.out.println(&quot;dob average is &quot; + w);&nbsp; <br />
	&nbsp; <br />
	&nbsp;&nbsp;&nbsp; Float fnums[] = { 1.0F, 2.0F, 3.0F, 4.0F, 5.0F };&nbsp; <br />
	&nbsp;&nbsp;&nbsp; Stats&lt; Float&gt; fob = new Stats&lt; Float&gt;(fnums);&nbsp;&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp; double x = fob.average();&nbsp; <br />
	&nbsp;&nbsp;&nbsp; System.out.println(&quot;fob average is &quot; + x);&nbsp; <br />
	&nbsp; <br />
	&nbsp;&nbsp;&nbsp; // 看哪二个数组有相同的平均值. <br />
	&nbsp;&nbsp;&nbsp; System.out.print(&quot;Averages of iob and dob &quot;); <br />
	&nbsp;&nbsp;&nbsp; if(iob.sameAvg(dob)) <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(&quot;are the same.&quot;);&nbsp; <br />
	&nbsp;&nbsp;&nbsp; else <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(&quot;differ.&quot;);&nbsp; </p>
<p>	&nbsp;&nbsp;&nbsp; System.out.print(&quot;Averages of iob and fob &quot;); <br />
	&nbsp;&nbsp;&nbsp; if(iob.sameAvg(fob)) <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(&quot;are the same.&quot;);&nbsp; <br />
	&nbsp;&nbsp;&nbsp; else <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(&quot;differ.&quot;);&nbsp; <br />
	&nbsp; }&nbsp;&nbsp; <br />
	}</p>
<p>	运行结果:</p>
<p>	C:\java&gt;java&nbsp;&nbsp; WildcardDemo<br />
	iob average is 3.0<br />
	dob average is 3.3<br />
	fob average is 3.0<br />
	Averages of iob and dob differ.<br />
	Averages of iob and fob are the same.</p>
<p>
	listing 7<br />
	// 有界通配符. </p>
<p>	// 二维空间. <br />
	class TwoD { <br />
	&nbsp; int x, y; </p>
<p>	&nbsp; TwoD(int a, int b) { <br />
	&nbsp;&nbsp;&nbsp; x = a; <br />
	&nbsp;&nbsp;&nbsp; y = b; <br />
	&nbsp; } <br />
	} </p>
<p>	// 三维空间. <br />
	class ThreeD extends TwoD { <br />
	&nbsp; int z; <br />
	&nbsp;&nbsp; <br />
	&nbsp; ThreeD(int a, int b, int c) { <br />
	&nbsp;&nbsp;&nbsp; super(a, b); <br />
	&nbsp;&nbsp;&nbsp; z = c; <br />
	&nbsp; } <br />
	} </p>
<p>	// 四维空间. <br />
	class FourD extends ThreeD { <br />
	&nbsp; int t; </p>
<p>	&nbsp; FourD(int a, int b, int c, int d) { <br />
	&nbsp;&nbsp;&nbsp; super(a, b, c); <br />
	&nbsp;&nbsp;&nbsp; t = d;&nbsp; <br />
	&nbsp; } <br />
	} </p>
<p>	class Coords&lt; T extends TwoD&gt; { //有界范型<br />
	&nbsp; T[] coords; </p>
<p>	&nbsp; Coords(T[] o) { coords = o; } <br />
	} </p>
<p>	// 示范. <br />
	class BoundedWildcard { <br />
	&nbsp; static void showXY(Coords&lt; ?&gt; c) { <br />
	&nbsp;&nbsp;&nbsp; System.out.println(&quot;X Y Coordinates:&quot;); <br />
	&nbsp;&nbsp;&nbsp; for(int i=0; i &lt; c.coords.length; i++) <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(c.coords[i].x + &quot; &quot; + <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c.coords[i].y); <br />
	&nbsp;&nbsp;&nbsp; System.out.println(); <br />
	&nbsp; } </p>
<p>	&nbsp; static void showXYZ(Coords&lt; ? extends ThreeD&gt; c) { <br />
	&nbsp;&nbsp;&nbsp; System.out.println(&quot;X Y Z Coordinates:&quot;); <br />
	&nbsp;&nbsp;&nbsp; for(int i=0; i &lt; c.coords.length; i++) <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(c.coords[i].x + &quot; &quot; + <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c.coords[i].y + &quot; &quot; + <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c.coords[i].z); <br />
	&nbsp;&nbsp;&nbsp; System.out.println(); <br />
	&nbsp; } </p>
<p>	&nbsp; static void showAll(Coords&lt; ? extends FourD&gt; c) { <br />
	&nbsp;&nbsp;&nbsp; System.out.println(&quot;X Y Z T Coordinates:&quot;); <br />
	&nbsp;&nbsp;&nbsp; for(int i=0; i &lt; c.coords.length; i++) <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(c.coords[i].x + &quot; &quot; + <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c.coords[i].y + &quot; &quot; + <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c.coords[i].z + &quot; &quot; + <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c.coords[i].t); <br />
	&nbsp;&nbsp;&nbsp; System.out.println(); <br />
	&nbsp; } </p>
<p>	&nbsp; public static void main(String args[]) { <br />
	&nbsp;&nbsp;&nbsp; TwoD td[] = { <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new TwoD(0, 0), <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new TwoD(7, 9), <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new TwoD(18, 4), <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new TwoD(-1, -23) <br />
	&nbsp;&nbsp;&nbsp; }; </p>
<p>	&nbsp;&nbsp;&nbsp; Coords&lt; TwoD&gt; tdlocs = new Coords&lt; TwoD&gt;(td);&nbsp;&nbsp;&nbsp;&nbsp; </p>
<p>	&nbsp;&nbsp;&nbsp; System.out.println(&quot;Contents of tdlocs.&quot;); <br />
	&nbsp;&nbsp;&nbsp; showXY(tdlocs); // OK, is a TwoD <br />
	//&nbsp; showXYZ(tdlocs); // Error, not a ThreeD <br />
	//&nbsp; showAll(tdlocs); // Erorr, not a FourD </p>
<p>	&nbsp;&nbsp;&nbsp; // 创建一些四维点<br />
	&nbsp;&nbsp;&nbsp; FourD fd[] = { <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new FourD(1, 2, 3, 4), <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new FourD(6, 8, 14, 8), <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new FourD(22, 9, 4, 9), <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new FourD(3, -2, -23, 17) <br />
	&nbsp;&nbsp;&nbsp; }; </p>
<p>	&nbsp;&nbsp;&nbsp; Coords&lt; FourD&gt; fdlocs = new Coords&lt; FourD&gt;(fd);&nbsp;&nbsp;&nbsp;&nbsp; </p>
<p>	&nbsp;&nbsp;&nbsp; System.out.println(&quot;Contents of fdlocs.&quot;); <br />
	&nbsp;&nbsp;&nbsp; //这些都不会产生错误. <br />
	&nbsp;&nbsp;&nbsp; showXY(fdlocs);&nbsp; <br />
	&nbsp;&nbsp;&nbsp; showXYZ(fdlocs); <br />
	&nbsp;&nbsp;&nbsp; showAll(fdlocs); <br />
	&nbsp; } <br />
	}</p>
<p>	清单 8<br />
	// 示范简单的范型方法 <br />
	class GenMethDemo {&nbsp; </p>
<p>	&nbsp; // 静态的范型方法,测试一个对象是否在一个数组中. <br />
	&nbsp; static &lt; T, V extends T&gt; boolean isIn(T x, V[] y) { </p>
<p>	&nbsp;&nbsp;&nbsp; for(int i=0; i &lt; y.length; i++) <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(x.equals(y[i])) return true; </p>
<p>	&nbsp;&nbsp;&nbsp; return false; <br />
	&nbsp; } </p>
<p>	&nbsp; public static void main(String args[]) {&nbsp; </p>
<p>	&nbsp;&nbsp;&nbsp; // 对Integers使用isIn()方法. <br />
	&nbsp;&nbsp;&nbsp; Integer nums[] = { 1, 2, 3, 4, 5 }; </p>
<p>	&nbsp;&nbsp;&nbsp; if(isIn(2, nums)) <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(&quot;2 is in nums&quot;); </p>
<p>	&nbsp;&nbsp;&nbsp; if(!isIn(7, nums)) <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(&quot;7 is not in nums&quot;); </p>
<p>	&nbsp;&nbsp;&nbsp; System.out.println(); </p>
<p>	&nbsp;&nbsp;&nbsp; // 对Strings使用isIn()<br />
	&nbsp;&nbsp;&nbsp; String strs[] = { &quot;one&quot;, &quot;two&quot;, &quot;three&quot;, <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;four&quot;, &quot;five&quot; }; </p>
<p>	&nbsp;&nbsp;&nbsp; if(isIn(&quot;two&quot;, strs)) <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(&quot;two is in strs&quot;); </p>
<p>	&nbsp;&nbsp;&nbsp; if(!isIn(&quot;seven&quot;, strs)) <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(&quot;seven is not in strs&quot;); </p>
<p>	&nbsp;&nbsp;&nbsp; // 不能编译,类型必须一致. <br />
	&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp; if(isIn(&quot;two&quot;, nums)) <br />
	&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(&quot;two is in strs&quot;); <br />
	&nbsp; }&nbsp; <br />
	}</p>
<p>	清单 9<br />
	// 泛型构造器. <br />
	class GenCons { <br />
	&nbsp; private double val; </p>
<p>	&nbsp; &lt; T extends Number&gt; GenCons(T arg) { <br />
	&nbsp;&nbsp;&nbsp; val = arg.doubleValue(); <br />
	&nbsp; } </p>
<p>	&nbsp; void showval() { <br />
	&nbsp;&nbsp;&nbsp; System.out.println(&quot;val: &quot; + val); <br />
	&nbsp; } <br />
	} </p>
<p>	class GenConsDemo { <br />
	&nbsp; public static void main(String args[]) { </p>
<p>	&nbsp;&nbsp;&nbsp; GenCons test = new GenCons(100); <br />
	&nbsp;&nbsp;&nbsp; GenCons test2 = new GenCons(123.5F); </p>
<p>	&nbsp;&nbsp;&nbsp; test.showval(); <br />
	&nbsp;&nbsp;&nbsp; test2.showval(); <br />
	&nbsp; } <br />
	}<br />
	运行结果:<br />
	C:\java&gt;java&nbsp;&nbsp; GenConsDemo<br />
	val: 100.0<br />
	val: 123.5</p>
<p>	清单 10<br />
	// 一个泛型接口的例子. </p>
<p>	// 来用返回某个对象集的最小或最大值. <br />
	interface MinMax&lt; T extends Comparable&lt; T&gt;&gt; { <br />
	&nbsp; T min(); <br />
	&nbsp; T max(); <br />
	} </p>
<p>	//MyClass实现接口MinMax<br />
	class MyClass&lt; T extends Comparable&lt; T&gt;&gt; implements MinMax&lt; T&gt; { <br />
	&nbsp; T[] vals; </p>
<p>	&nbsp; MyClass(T[] o) { vals = o; } </p>
<p>	&nbsp; // 返回最小值. <br />
	&nbsp; public T min() { <br />
	&nbsp;&nbsp;&nbsp; T v = vals[0]; </p>
<p>	&nbsp;&nbsp;&nbsp; for(int i=1; i &lt; vals.length; i++) <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(vals[i].compareTo(v) &lt; 0) v = vals[i]; </p>
<p>	&nbsp;&nbsp;&nbsp; return v; <br />
	&nbsp; } </p>
<p>	&nbsp; // 返回最大值. <br />
	&nbsp; public T max() { <br />
	&nbsp;&nbsp;&nbsp; T v = vals[0]; </p>
<p>	&nbsp;&nbsp;&nbsp; for(int i=1; i &lt; vals.length; i++) <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(vals[i].compareTo(v) &gt; 0) v = vals[i]; </p>
<p>	&nbsp;&nbsp;&nbsp; return v; <br />
	&nbsp; } <br />
	} </p>
<p>	class GenIFDemo { <br />
	&nbsp; public static void main(String args[]) { <br />
	&nbsp;&nbsp;&nbsp; Integer inums[] = {3, 6, 2, 8, 6 }; <br />
	&nbsp;&nbsp;&nbsp; Character chs[] = {&#39;b&#39;, &#39;r&#39;, &#39;p&#39;, &#39;w&#39; }; </p>
<p>	&nbsp;&nbsp;&nbsp; MyClass&lt; Integer&gt; iob = new MyClass&lt; Integer&gt;(inums); <br />
	&nbsp;&nbsp;&nbsp; MyClass&lt; Character&gt; cob = new MyClass&lt; Character&gt;(chs); </p>
<p>	&nbsp;&nbsp;&nbsp; System.out.println(&quot;Max value in inums: &quot; + iob.max()); <br />
	&nbsp;&nbsp;&nbsp; System.out.println(&quot;Min value in inums: &quot; + iob.min()); </p>
<p>	&nbsp;&nbsp;&nbsp; System.out.println(&quot;Max value in chs: &quot; + cob.max()); <br />
	&nbsp;&nbsp;&nbsp; System.out.println(&quot;Min value in chs: &quot; + cob.min()); <br />
	&nbsp; } <br />
	}</p>
<p>	清单 11<br />
	// 示范使用原始类型. 一个泛型类在使用时可以不带类型参数,同时带来的是失去了类型安全.<br />
	class Gen&lt; T&gt; {&nbsp; <br />
	&nbsp; T ob; // 声明一个T类型的对象<br />
	&nbsp;&nbsp;&nbsp; <br />
	&nbsp; Gen(T o) {&nbsp; <br />
	&nbsp;&nbsp;&nbsp; ob = o;&nbsp; <br />
	&nbsp; }&nbsp; <br />
	&nbsp; <br />
	&nbsp; T getob() {&nbsp; <br />
	&nbsp;&nbsp;&nbsp; return ob;&nbsp; <br />
	&nbsp; }&nbsp; <br />
	}&nbsp; <br />
	&nbsp; <br />
	// 使用原始类型. <br />
	class RawDemo {&nbsp; <br />
	&nbsp; public static void main(String args[]) {&nbsp; </p>
<p>	&nbsp;&nbsp;&nbsp; Gen&lt; Integer&gt; iOb = new Gen&lt; Integer&gt;(88);&nbsp; <br />
	&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp; Gen&lt; String&gt; strOb = new Gen&lt; String&gt;(&quot;Generics Test&quot;);&nbsp; <br />
	&nbsp; <br />
	&nbsp;&nbsp;&nbsp; // 创建一个使用原始类型参数的Gen<br />
	&nbsp;&nbsp;&nbsp; Gen raw = new Gen(new Double(98.6)); </p>
<p>	&nbsp;&nbsp;&nbsp; // 类型转换是必须的<br />
	&nbsp;&nbsp;&nbsp; double d = (Double) raw.getob(); <br />
	&nbsp;&nbsp;&nbsp; System.out.println(&quot;value: &quot; + d); </p>
<p>	&nbsp;&nbsp;&nbsp; //int i = (Integer) raw.getob(); // 运行时错误 </p>
<p>	&nbsp;&nbsp;&nbsp; strOb = raw; // 可以通过编译 <br />
	&nbsp;&nbsp;&nbsp; // String str = strOb.getob(); // 运行时错误&nbsp; <br />
	&nbsp;&nbsp;&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp; raw = iOb; // 可能编译 <br />
	&nbsp;&nbsp;&nbsp; // d = (Double) raw.getob(); // 运行时错误 <br />
	&nbsp; }&nbsp; <br />
	}</p>
<p>	清单 12<br />
	// 泛型类层次. 使用泛型超类<br />
	class Gen&lt; T&gt; {&nbsp; <br />
	&nbsp; T ob; <br />
	&nbsp;&nbsp;&nbsp; <br />
	&nbsp; Gen(T o) {&nbsp; <br />
	&nbsp;&nbsp;&nbsp; ob = o;&nbsp; <br />
	&nbsp; }&nbsp; <br />
	&nbsp; <br />
	&nbsp; // Return ob.&nbsp; <br />
	&nbsp; T getob() {&nbsp; <br />
	&nbsp;&nbsp;&nbsp; return ob;&nbsp; <br />
	&nbsp; }&nbsp; <br />
	}&nbsp; </p>
<p>	// Gen的子类<br />
	class Gen2&lt; T&gt; extends Gen&lt; T&gt; { <br />
	&nbsp; Gen2(T o) { <br />
	&nbsp;&nbsp;&nbsp; super(o); <br />
	&nbsp; } <br />
	}</p>
<p>	清单 13<br />
	// 子类能增加自己的类型参数. <br />
	class Gen&lt; T&gt; {&nbsp; <br />
	&nbsp; T ob; <br />
	&nbsp;&nbsp;&nbsp; <br />
	&nbsp; Gen(T o) {&nbsp; <br />
	&nbsp;&nbsp;&nbsp; ob = o;&nbsp; <br />
	&nbsp; }&nbsp; <br />
	&nbsp; <br />
	&nbsp; T getob() {&nbsp; <br />
	&nbsp;&nbsp;&nbsp; return ob;&nbsp; <br />
	&nbsp; }&nbsp; <br />
	}&nbsp; </p>
<p>	class Gen2&lt; T, V&gt; extends Gen&lt; T&gt; { <br />
	&nbsp; V ob2; </p>
<p>	&nbsp; Gen2(T o, V o2) { <br />
	&nbsp;&nbsp;&nbsp; super(o); <br />
	&nbsp;&nbsp;&nbsp; ob2 = o2; <br />
	&nbsp; } </p>
<p>	&nbsp; V getob2() { <br />
	&nbsp;&nbsp;&nbsp; return ob2; <br />
	&nbsp; } <br />
	} <br />
	&nbsp; <br />
	// 创建一个Gen2类型的对象. <br />
	class HierDemo {&nbsp; <br />
	&nbsp; public static void main(String args[]) {&nbsp; <br />
	&nbsp;&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp; Gen2&lt; String, Integer&gt; x = new Gen2&lt; String, Integer&gt;(&quot;Value is: &quot;, 99);&nbsp; </p>
<p>	&nbsp;&nbsp;&nbsp; System.out.print(x.getob()); <br />
	&nbsp;&nbsp;&nbsp; System.out.println(x.getob2()); <br />
	&nbsp; }&nbsp; <br />
	}</p>
<p>	清单 14<br />
	// 泛型子类 </p>
<p>	class NonGen { <br />
	&nbsp; int num; </p>
<p>	&nbsp; NonGen(int i) { <br />
	&nbsp;&nbsp;&nbsp; num = i; <br />
	&nbsp; } </p>
<p>	&nbsp; int getnum() { <br />
	&nbsp;&nbsp;&nbsp; return num; <br />
	&nbsp; } <br />
	} </p>
<p>	// 一个泛型子类 <br />
	class Gen&lt; T&gt; extends NonGen {&nbsp; <br />
	&nbsp; T ob; <br />
	&nbsp;&nbsp;&nbsp; <br />
	&nbsp; Gen(T o, int i) {&nbsp; <br />
	&nbsp;&nbsp;&nbsp; super(i); <br />
	&nbsp;&nbsp;&nbsp; ob = o;&nbsp; <br />
	&nbsp; }&nbsp; <br />
	&nbsp; <br />
	&nbsp; T getob() {&nbsp; <br />
	&nbsp;&nbsp;&nbsp; return ob;&nbsp; <br />
	&nbsp; }&nbsp; <br />
	}&nbsp; <br />
	&nbsp; <br />
	class HierDemo2 {&nbsp; <br />
	&nbsp; public static void main(String args[]) {&nbsp; <br />
	&nbsp;&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp; Gen&lt; String&gt; w = new Gen&lt; String&gt;(&quot;Hello&quot;, 47); <br />
	&nbsp;&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp; System.out.print(w.getob() + &quot; &quot;); <br />
	&nbsp;&nbsp;&nbsp; System.out.println(w.getnum()); <br />
	&nbsp; }&nbsp; <br />
	}</p>
<p>	清单 15<br />
	// 泛型层次中的运行时类型比较.&nbsp; <br />
	class Gen&lt; T&gt; {&nbsp;&nbsp; <br />
	&nbsp; T ob;&nbsp; <br />
	&nbsp;&nbsp;&nbsp;&nbsp; <br />
	&nbsp; Gen(T o) {&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp; ob = o;&nbsp;&nbsp; <br />
	&nbsp; }&nbsp;&nbsp; <br />
	&nbsp;&nbsp; <br />
	&nbsp; T getob() {&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp; return ob;&nbsp;&nbsp; <br />
	&nbsp; }&nbsp;&nbsp; <br />
	}&nbsp;&nbsp; <br />
	&nbsp; <br />
	// Gen的子类.&nbsp; <br />
	class Gen2&lt; T&gt; extends Gen&lt; T&gt; {&nbsp; <br />
	&nbsp; Gen2(T o) {&nbsp; <br />
	&nbsp;&nbsp;&nbsp; super(o);&nbsp; <br />
	&nbsp; }&nbsp; <br />
	}&nbsp; <br />
	&nbsp; <br />
	class HierDemo3 {&nbsp;&nbsp; <br />
	&nbsp; public static void main(String args[]) {&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp; // Create a Gen object for Integers.&nbsp; <br />
	&nbsp;&nbsp;&nbsp; Gen&lt; Integer&gt; iOb = new Gen&lt; Integer&gt;(88);&nbsp; <br />
	&nbsp; <br />
	&nbsp;&nbsp;&nbsp; // Create a Gen2 object for Integers.&nbsp; <br />
	&nbsp;&nbsp;&nbsp; Gen2&lt; Integer&gt; iOb2 = new Gen2&lt; Integer&gt;(99);&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp; // Create a Gen2 object for Strings.&nbsp; <br />
	&nbsp;&nbsp;&nbsp; Gen2&lt; String&gt; strOb2 = new Gen2&lt; String&gt;(&quot;Generics Test&quot;);&nbsp;&nbsp; <br />
	&nbsp; <br />
	&nbsp;&nbsp;&nbsp; // See if iOb2 is some form of Gen2. <br />
	&nbsp;&nbsp;&nbsp; if(iOb2 instanceof Gen2&lt; ?&gt;)&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(&quot;iOb2 is instance of Gen2&quot;);&nbsp; </p>
<p>	&nbsp;&nbsp;&nbsp; // See if iOb2 is some form of Gen. <br />
	&nbsp;&nbsp;&nbsp; if(iOb2 instanceof Gen&lt; ?&gt;)&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(&quot;iOb2 is instance of Gen&quot;);&nbsp; <br />
	&nbsp; <br />
	&nbsp;&nbsp;&nbsp; System.out.println();&nbsp; <br />
	&nbsp; <br />
	&nbsp;&nbsp;&nbsp; // See if strOb2 is a Gen2. <br />
	&nbsp;&nbsp;&nbsp; if(strOb2 instanceof Gen2&lt; ?&gt;)&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(&quot;strOb is instance of Gen2&quot;);&nbsp; <br />
	&nbsp; <br />
	&nbsp;&nbsp;&nbsp; // See if strOb2 is a Gen. <br />
	&nbsp;&nbsp;&nbsp; if(strOb2 instanceof Gen&lt; ?&gt;)&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(&quot;strOb is instance of Gen&quot;);&nbsp; </p>
<p>	&nbsp;&nbsp;&nbsp; System.out.println();&nbsp; <br />
	&nbsp; <br />
	&nbsp;&nbsp;&nbsp; // See if iOb is an instance of Gen2, which its not. <br />
	&nbsp;&nbsp;&nbsp; if(iOb instanceof Gen2&lt; ?&gt;)&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(&quot;iOb is instance of Gen2&quot;);&nbsp; <br />
	&nbsp; <br />
	&nbsp;&nbsp;&nbsp; // See if iOb is an instance of Gen, which it is. <br />
	&nbsp;&nbsp;&nbsp; if(iOb instanceof Gen&lt; ?&gt;)&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(&quot;iOb is instance of Gen&quot;);&nbsp; <br />
	&nbsp; <br />
	&nbsp;&nbsp;&nbsp; // The following can&#39;t be compiled because&nbsp; <br />
	&nbsp;&nbsp;&nbsp; // generic type info does not exist at runtime. <br />
	&nbsp;&nbsp;&nbsp; // if(iOb2 instanceof Gen2&lt; Integer&gt;)&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp; // System.out.println(&quot;iOb2 is instance of Gen2&lt; Integer&gt;&quot;);&nbsp; <br />
	&nbsp; }&nbsp;&nbsp; <br />
	}</p>
<p>	运行结果:</p>
<p>	C:\java&gt;java&nbsp;&nbsp;&nbsp;&nbsp; HierDemo3<br />
	iOb2 is instance of Gen2<br />
	iOb2 is instance of Gen</p>
<p>	strOb is instance of Gen2<br />
	strOb is instance of Gen</p>
<p>	iOb is instance of Gen</p>
<p>	listing 16<br />
	// 重写泛型类中的方法<br />
	class Gen&lt; T&gt; {&nbsp; <br />
	&nbsp; T ob; </p>
<p>	&nbsp; Gen(T o) {&nbsp; <br />
	&nbsp;&nbsp;&nbsp; ob = o;&nbsp; <br />
	&nbsp; }&nbsp; <br />
	&nbsp; <br />
	&nbsp; <br />
	&nbsp; T getob() {&nbsp; <br />
	&nbsp;&nbsp;&nbsp; System.out.print(&quot;Gen&#39;s getob(): &quot; ); <br />
	&nbsp;&nbsp;&nbsp; return ob;&nbsp; <br />
	&nbsp; }&nbsp; <br />
	}&nbsp; </p>
<p>	// Gen的子类重写了getob(). <br />
	class Gen2&lt; T&gt; extends Gen&lt; T&gt; { </p>
<p>	&nbsp; Gen2(T o) { <br />
	&nbsp;&nbsp;&nbsp; super(o); <br />
	&nbsp; } <br />
	&nbsp;&nbsp; <br />
	&nbsp; T getob() {&nbsp; <br />
	&nbsp;&nbsp;&nbsp; System.out.print(&quot;Gen2&#39;s getob(): &quot;); <br />
	&nbsp;&nbsp;&nbsp; return ob;&nbsp; <br />
	&nbsp; }&nbsp; <br />
	} <br />
	&nbsp; <br />
	// 演示重写泛型方法. <br />
	class OverrideDemo {&nbsp; <br />
	&nbsp; public static void main(String args[]) {&nbsp; <br />
	&nbsp;&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp; // Create a Gen object for Integers. <br />
	&nbsp;&nbsp;&nbsp; Gen&lt; Integer&gt; iOb = new Gen&lt; Integer&gt;(88); </p>
<p>	&nbsp;&nbsp;&nbsp; // Create a Gen2 object for Integers. <br />
	&nbsp;&nbsp;&nbsp; Gen2&lt; Integer&gt; iOb2 = new Gen2&lt; Integer&gt;(99);&nbsp; <br />
	&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp; // Create a Gen2 object for Strings. <br />
	&nbsp;&nbsp;&nbsp; Gen2&lt; String&gt; strOb2 = new Gen2&lt; String&gt;(&quot;Generics Test&quot;);&nbsp; </p>
<p>	&nbsp;&nbsp;&nbsp; System.out.println(iOb.getob()); <br />
	&nbsp;&nbsp;&nbsp; System.out.println(iOb2.getob()); <br />
	&nbsp;&nbsp;&nbsp; System.out.println(strOb2.getob()); <br />
	&nbsp; }&nbsp; <br />
	}<br />
	运行结果:</p>
<p>	C:\java&gt;java&nbsp;&nbsp; OverrideDemo<br />
	Gen&#39;s getob(): 88<br />
	Gen2&#39;s getob(): 99<br />
	Gen2&#39;s getob(): Generics Test</p>
<p>
	清单 17<br />
	// 不使用泛型,迭代一个collection. <br />
	import java.util.*; </p>
<p>	class OldStyle {&nbsp; <br />
	&nbsp; public static void main(String args[]) { <br />
	&nbsp;&nbsp;&nbsp; ArrayList list = new ArrayList(); </p>
<p>	&nbsp;&nbsp;&nbsp; list.add(&quot;one&quot;); <br />
	&nbsp;&nbsp;&nbsp; list.add(&quot;two&quot;); <br />
	&nbsp;&nbsp;&nbsp; list.add(&quot;three&quot;); <br />
	&nbsp;&nbsp;&nbsp; list.add(&quot;four&quot;); </p>
<p>	&nbsp;&nbsp;&nbsp; Iterator itr = list.iterator(); <br />
	&nbsp;&nbsp;&nbsp; while(itr.hasNext()) { </p>
<p>	&nbsp;&nbsp;&nbsp;&nbsp; <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String str = (String) itr.next(); // 这里需要类型转换. </p>
<p>	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(str + &quot; is &quot; + str.length() + &quot; chars long.&quot;); <br />
	&nbsp;&nbsp;&nbsp; } <br />
	&nbsp; }&nbsp; <br />
	}</p>
<p>	清单 18<br />
	// 新的泛型版本. <br />
	import java.util.*; </p>
<p>	class NewStyle {&nbsp; <br />
	&nbsp; public static void main(String args[]) { </p>
<p>	&nbsp;&nbsp;&nbsp; ArrayList&lt; String&gt; list = new ArrayList&lt; String&gt;(); </p>
<p>	&nbsp;&nbsp;&nbsp; list.add(&quot;one&quot;); <br />
	&nbsp;&nbsp;&nbsp; list.add(&quot;two&quot;); <br />
	&nbsp;&nbsp;&nbsp; list.add(&quot;three&quot;); <br />
	&nbsp;&nbsp;&nbsp; list.add(&quot;four&quot;); </p>
<p>	&nbsp;&nbsp;&nbsp; // 注意Iterator 也是泛型. <br />
	&nbsp;&nbsp;&nbsp; Iterator&lt; String&gt; itr = list.iterator(); </p>
<p>	&nbsp;&nbsp;&nbsp; // Iterator&lt; Integer&gt; itr = list.iterator(); // 这样会产生编译错误! </p>
<p>	&nbsp;&nbsp;&nbsp; while(itr.hasNext()) { <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String str = itr.next(); // no cast needed </p>
<p>	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Now, the following line is a compile-time, <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // rather than runtime, error. <br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Integer i = itr.next(); // this won&#39;t compile </p>
<p>	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(str + &quot; is &quot; + str.length() + &quot; chars long.&quot;); <br />
	&nbsp;&nbsp;&nbsp; } <br />
	&nbsp; }&nbsp; <br />
	}</p>
<p>	清单 19(擦拭)<br />
	// 这个类编译后,T将被Object替换掉. <br />
	class Gen&lt; T&gt; {&nbsp; <br />
	&nbsp; T ob; // here, T will be replaced by Object <br />
	&nbsp;&nbsp;&nbsp; <br />
	&nbsp; Gen(T o) {&nbsp; <br />
	&nbsp;&nbsp;&nbsp; ob = o;&nbsp; <br />
	&nbsp; }&nbsp; <br />
	&nbsp; <br />
	&nbsp; // Return ob.&nbsp; <br />
	&nbsp; T getob() {&nbsp; <br />
	&nbsp;&nbsp;&nbsp; return ob;&nbsp; <br />
	&nbsp; }&nbsp; <br />
	}&nbsp; </p>
<p>	// 编译后.这个类中的T 将被String替换. <br />
	class GenStr&lt; T extends String&gt; { <br />
	&nbsp; T str; // here, T will be replaced by String </p>
<p>	&nbsp; GenStr(T o) {&nbsp; <br />
	&nbsp;&nbsp;&nbsp; str = o;&nbsp; <br />
	&nbsp; }&nbsp; </p>
<p>	&nbsp; T getstr() { return str; } <br />
	}</p>
<p>	清单 20<br />
	class GenTypeDemo {&nbsp; <br />
	&nbsp; public&nbsp; static void main(String args[]) {&nbsp; <br />
	&nbsp;&nbsp;&nbsp; Gen&lt; Integer&gt; iOb = new Gen&lt; Integer&gt;(99);&nbsp; <br />
	&nbsp;&nbsp;&nbsp; Gen&lt; Float&gt; fOb = new Gen&lt; Float&gt;(102.2F); </p>
<p>	&nbsp;&nbsp;&nbsp; System.out.println(iOb.getClass().getName()); <br />
	&nbsp;&nbsp;&nbsp; System.out.println(fOb.getClass().getName()); <br />
	&nbsp; } <br />
	}</p>
<p>	运行的输出:(在编译时所有类型都被擦拭了,运行时,只有原始类型存在.)<br />
	Gen<br />
	Gen</font></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ideagrace.com/blog/?feed=rss2&amp;p=448</wfw:commentRss>
		</item>
		<item>
		<title>vi查找和替换的使用方法</title>
		<link>http://www.ideagrace.com/blog/?p=446</link>
		<comments>http://www.ideagrace.com/blog/?p=446#comments</comments>
		<pubDate>Thu, 13 May 2010 05:40:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[电脑技术]]></category>

		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.ideagrace.com/blog/?p=446</guid>
		<description><![CDATA[
	当你用vi打开一个文件后，因为文件太长，如何才能找到你所要查找的关键字呢？在vi里可没有菜单-〉查找，不过没关系，你在命令模式下敲斜杆(/)这时 在状态栏（也就是屏幕左下脚）就出现... ]]></description>
			<content:encoded><![CDATA[<p>
	当你用vi打开一个文件后，因为文件太长，如何才能找到你所要查找的关键字呢？在vi里可没有菜单-〉查找，不过没关系，你在命令模式下敲斜杆(/)这时 在状态栏（也就是屏幕左下脚）就出现了 &ldquo;/&rdquo;然后输入你要查找的关键字敲回车就可以了。<br />
	如果你要继续查找此关键字，敲字符n就可以继续查找了。值得注意的是&ldquo;/&rdquo;是向下查找，而&ldquo;?&rdquo;是向上查找，而在键盘定义上&ldquo;?&rdquo;刚好是&ldquo;/&rdquo;的上档符。</p>
<p>
	&nbsp;</p>
<p>
	<font face="Courier New" size="2">vi是unix和linux系统上最强大和最普遍的文本编辑工具，一般而 言，对于初次接触vi的朋友，往往对它的字符替换不是很熟悉，下面做一个简单的介绍:</font></p>
<p>
	<font face="Courier New" size="2">对于字符替换，应该解决这样几个问题：</font></p>
<ul>
<li>
		<font face="Courier New" size="2">用谁替换谁的问题；</font></li>
<li>
		<font face="Courier New" size="2">在那个范围内进行查找和替换；</font></li>
<li>
		<font face="Courier New" size="2">是替换查找到的第一个还是所有匹配的项全部替换；</font></li>
</ul>
<p>
	<font face="Courier New" size="2">vi命令的各种选项就提供了这样的选择按住esc键，进入命令状态，然后 按：，进入命令模式，开始输入查找和替换命令, 一般形式如下：</font></p>
<ul>
<li>
		<font face="Courier New" size="2">ranges/source/target/g 解释：range表示要搜索的范围</font></li>
<li>
		<font face="Courier New" size="2">&quot;s&quot;这个字母表示搜索的意思，这个是不能缺少的.</font></li>
<li>
		<font face="Courier New" size="2">source表示要搜索的字串.</font></li>
<li>
		<font face="Courier New" size="2">target表示要进行替换的字串.</font></li>
<li>
		<font face="Courier New" size="2">g表示对于符合条件的字串全部进行替换.</font></li>
</ul>
<p>
	<font face="Courier New" size="2">其中range的取值如下：</font></p>
<ul>
<li>
		<font face="Courier New" size="2">%表示全部的行；</font></li>
<li>
		<font face="Courier New" size="2">.表示当前行；</font></li>
<li>
		<font face="Courier New" size="2">$表示最后一行；</font></li>
<li>
		<font face="Courier New" size="2">可以用具体的数字表示具体的行，如10，20等；</font></li>
</ul>
<p>
	<font face="Courier New" size="2">上述的标志可以进行组合:</font></p>
<p>
	<font face="Courier New" size="2">如:</font></p>
<ul>
<li>
		<font face="Courier New" size="2">.,$s/source/target/g&nbsp; 表示从当前行到最后一行的搜索替换；</font></li>
<li>
		<font face="Courier New" size="2">又如10,20s/</font></li>
<li>
		<font face="Courier New" size="2">10,$s/等等组合；</font></li>
</ul>
<p>
	<font face="Courier New" size="2">举例说明:</font></p>
<ul>
<li>
		<font face="Courier New" size="2">:s/str1/str2/ 用字符串 str2 替换行中首次出现的字符串</font></li>
<li>
		<font face="Courier New" size="2">str1 :s/str1/str2/g 用字符串 str2 替换行中所有出现的字符串 str1 </font></li>
<li>
		<font face="Courier New" size="2">:.,$ s/str1/str2/g 用字符串 str2 替换正文当前行到末尾所有出现的字符串</font></li>
<li>
		<font face="Courier New" size="2">str1 :1,$ s/str1/str2/g 用字符串 str2 替换正文中所有出现的字符串</font></li>
<li>
		<font face="Courier New" size="2">str1 :g/str1/s//str2/g </font></li>
</ul>
<div>
	<font face="Courier New" size="2">功能同上从上述替换命令可以看到：</font></div>
<ul>
<li>
		<font face="Courier New" size="2">g 放在命令末尾，表示对搜索字符串的每次出现进行替换；</font></li>
<li>
		<font face="Courier New" size="2">不加 g，表示只对搜索字符串的首次出现进行替换；</font></li>
<li>
		<font face="Courier New" size="2">g 放在命令开头，表示对正文中所有包含搜索字符串的行进行替换操作。 </font></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.ideagrace.com/blog/?feed=rss2&amp;p=446</wfw:commentRss>
		</item>
		<item>
		<title>Linux上php连接Microsoft SQL Server 2005</title>
		<link>http://www.ideagrace.com/blog/?p=445</link>
		<comments>http://www.ideagrace.com/blog/?p=445#comments</comments>
		<pubDate>Fri, 07 May 2010 08:39:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[电脑技术]]></category>

		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.ideagrace.com/blog/?p=445</guid>
		<description><![CDATA[Linux下使PHP支持MSSQL(SQL Server)，需要先安装FreeTDS。
FreeTDS官方网站：http://www.freetds.org 当前版本0.82
1. 编译FreeTDS
下载FreeTDS并解压，进入该目录。
./configure &#8211;prefix=/usr/local/freetds &#8211;with-tdsver=8... ]]></description>
			<content:encoded><![CDATA[<p>Linux下使PHP支持MSSQL(SQL Server)，需要先安装FreeTDS。<br />
FreeTDS官方网站：http://www.freetds.org 当前版本0.82</p>
<p>1. 编译FreeTDS</p>
<p>下载FreeTDS并解压，进入该目录。<br />
./configure &#8211;prefix=/usr/local/freetds &#8211;with-tdsver=8.0 &#8211;enable-msdblib &#8211;enable-dbmfix &#8211;with-gnu-ld &#8211;enable-shared &#8211;enable-static<br />
make<br />
make install</p>
<p>2. 编译PHP</p>
<p>编译成模块</p>
<p>cd /path/to/php/source 进入PHP源码目录<br />
cd ext/mssql 进入MSSQL模块源码目录<br />
/usr/local/php/bin/phpize 生成编译配置文件<br />
./configure &#8211;with-php-config=/usr/local/php/bin/php-config &#8211;with-mssql=/usr/local/freetds<br />
make<br />
make install<br />
编译完成生成 mssql.so，修改php.ini，将该模块载入：<br />
extension=&#8221;/path/to/extension/mssql.so&#8221;</p>
<p>配置mssql<br />
cd /usr/local/freetds/etc<br />
编辑文件：<br />
vi freetds.conf</p>
<p>[global]<br />
        # TDS protocol version<br />
;       tds version = 4.2</p>
<p>        # Whether to write a TDSDUMP file for diagnostic purposes<br />
        # (setting this to /tmp is insecure on a multi-user system)<br />
;       dump file = /tmp/freetds.log<br />
;       debug flags = 0xffff</p>
<p>        # Command and connection timeouts<br />
;       timeout = 10<br />
;       connect timeout = 10</p>
<p>        # If you get out-of-memory errors, it may mean that your client<br />
        # is trying to allocate a huge buffer for a TEXT field.<br />
        # Try setting &#8216;text size&#8217; to a more reasonable limit<br />
        text size = 64512<br />
client charset = UTF-8  #加入</p>
<p>#加入<br />
[Server2005]<br />
        host = 192.168.x.x<br />
        port = 1433<br />
        tds version = 7.2</p>
<p>最后重启apache服务器。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ideagrace.com/blog/?feed=rss2&amp;p=445</wfw:commentRss>
		</item>
		<item>
		<title>MYSQL导出查询结果</title>
		<link>http://www.ideagrace.com/blog/?p=444</link>
		<comments>http://www.ideagrace.com/blog/?p=444#comments</comments>
		<pubDate>Wed, 05 May 2010 10:11:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[电脑技术]]></category>

		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.ideagrace.com/blog/?p=444</guid>
		<description><![CDATA[一般大家都会用 &#8220;SELECT INTO OUTFIL&#8221;将查询结果导出到文件，但是这种方法不能覆盖或者添加到已经创建的文件。例如：
mysql> select 1 into outfile &#8216;/tmp/t1.txt&#8217;;
Query OK, 1 row affected (0.00 s... ]]></description>
			<content:encoded><![CDATA[<p>一般大家都会用 &#8220;SELECT INTO OUTFIL&#8221;将查询结果导出到文件，但是这种方法不能覆盖或者添加到已经创建的文件。例如：<br />
mysql> select 1 into outfile &#8216;/tmp/t1.txt&#8217;;<br />
Query OK, 1 row affected (0.00 sec)<br />
mysql> select 1 into outfile &#8216;/tmp/t1.txt&#8217;;<br />
ERROR 1086 (HY000): File &#8216;/tmp/t1.txt&#8217; already exists</p>
<p>还可以使用另外一种方法：<br />
mysql> pager cat > /tmp/t1.txt<br />
PAGER set to &#8216;cat > /tmp/t1.txt&#8217;<br />
mysql> select 1;\! cat /tmp/t1.txt<br />
1 row in set (0.00 sec)<br />
+&#8212;+<br />
| 1 |<br />
+&#8212;+<br />
| 1 |<br />
+&#8212;+</p>
<p>这样你能很方便的查询到2条sql的差异：</p>
<p>mysql> pager cat > /tmp/t01.txt<br />
PAGER set to &#8216;cat > /tmp/t01.txt&#8217;<br />
mysql> select 12345 union select 67890;<br />
2 rows in set (0.02 sec)<br />
mysql> pager cat > /tmp/t02.txt<br />
PAGER set to &#8216;cat > /tmp/t02.txt&#8217;<br />
mysql> select 12345 union select 67891;<br />
2 rows in set (0.00 sec)</p>
<p>mysql> \! vimdiff -o /tmp/t0[12].txt<br />
2 files to edit<br />
+&#8212;&#8212;-+<br />
| 12345 |<br />
+&#8212;&#8212;-+<br />
| 12345 |<br />
| 67890 |<br />
+&#8212;&#8212;-+<br />
/tmp/t01.txt<br />
+&#8212;&#8212;-+<br />
| 12345 |<br />
+&#8212;&#8212;-+<br />
| 12345 |<br />
| 67891 |<br />
+&#8212;&#8212;+<br />
/tmp/t02.txt</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ideagrace.com/blog/?feed=rss2&amp;p=444</wfw:commentRss>
		</item>
		<item>
		<title>eclipse 编辑wsdl</title>
		<link>http://www.ideagrace.com/blog/?p=442</link>
		<comments>http://www.ideagrace.com/blog/?p=442#comments</comments>
		<pubDate>Sun, 02 May 2010 05:01:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[电脑技术]]></category>

		<category><![CDATA[Eclipse]]></category>

		<category><![CDATA[wsdl]]></category>

		<guid isPermaLink="false">http://www.ideagrace.com/blog/?p=442</guid>
		<description><![CDATA[
	添加新的方法，Add Operation之后，需要重新生成binding，&#8220;Generate Binding Content&#8230;&#34;.... ]]></description>
			<content:encoded><![CDATA[<p>
	添加新的方法，Add Operation之后，需要重新生成binding，&ldquo;Generate Binding Content&#8230;&quot;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ideagrace.com/blog/?feed=rss2&amp;p=442</wfw:commentRss>
		</item>
	</channel>
</rss>
