﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>语源科技BlogJava-xsm－－海阔天空</title><link>http://www.blogjava.net/xsm1034999/</link><description>JAVA AND DocNET！</description><language>zh-cn</language><lastBuildDate>Sun, 12 Apr 2026 06:08:32 GMT</lastBuildDate><pubDate>Sun, 12 Apr 2026 06:08:32 GMT</pubDate><ttl>60</ttl><item><title>关于JAVA的PO与VO</title><link>http://www.blogjava.net/xsm1034999/archive/2007/11/11/159706.html</link><dc:creator>xsm</dc:creator><author>xsm</author><pubDate>Sun, 11 Nov 2007 05:39:00 GMT</pubDate><guid>http://www.blogjava.net/xsm1034999/archive/2007/11/11/159706.html</guid><wfw:comment>http://www.blogjava.net/xsm1034999/comments/159706.html</wfw:comment><comments>http://www.blogjava.net/xsm1034999/archive/2007/11/11/159706.html#Feedback</comments><slash:comments>9</slash:comments><wfw:commentRss>http://www.blogjava.net/xsm1034999/comments/commentRss/159706.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/xsm1034999/services/trackbacks/159706.html</trackback:ping><description><![CDATA[
		<p>
				<font face="Courier New" size="4">
						<font face="Garamond">
								<font size="3">        我一直很矛盾：是否PO可以用在商业逻辑层，当作VO使用；还是将两者分开。在许多论坛上，这两者之争也很激烈。所以今天我打算把我的想法写下来。 <wbr><br /><font size="3"><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">          首先，java有几种对象(PO,VO,DAO,BO,POJO)   </font><wbr><br /></wbr></font><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">    <font size="3">     一、PO:persistant object 持久对象,可以看成是与数据库中的表相映射的java对象。使用Hibernate来生成PO是不错的选择。 </font></font><wbr><br /></wbr></wbr></font>
								<font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em" size="3">          二、VO:<font size="4">value object</font><font size="3">值对象。通常用于业务层之间的数据传递，和PO一样也是仅仅包含数据而已。但应是抽象出的业务对象,可以和表对应,也可以不,这根据业务的需要.<br /></font></font>      <font size="3">有一种观点就是：PO只能用在数据层，VO用在商业逻辑层和表示层。各层操作属于该层自己的数据对象，这样就可以降低各层之间的耦合，便于以后系统的维护和扩展。如果将PO用在各个层中就相当于我们使用全局变量，我们知道在OO设计非常不赞成使用全局变量。 <br />       但是每次都得进行VO-PO的转换，也确实很烦。我觉得有时候也可以在某个商业逻辑或者表示层使用PO，此时在这个商业逻辑的过程中PO的状态是不发生变化的，比如显示一条商品详细信息的商业逻辑。 <br />       在开发过的项目中，规模都很小，我一直都把PO当VO用，因为PO确实很方便，结合Hibernate的DAO，我使用JAVA的集合对象作为值传递的载体，当然Struts也是我的不二之选。 <br />       我认为：在一些直观的，简单的，不易发生变化的，不需要涉及多个PO时，传递值还是使用PO好，这样可以减少大量的工作量（也就意味着减少bug，减少风险），也不需要担心未来的维护工作！（待续） <br /></font></font>
				</font>
		</p>
<img src ="http://www.blogjava.net/xsm1034999/aggbug/159706.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/xsm1034999/" target="_blank">xsm</a> 2007-11-11 13:39 <a href="http://www.blogjava.net/xsm1034999/archive/2007/11/11/159706.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>使用hibernate+DAO组件（1）</title><link>http://www.blogjava.net/xsm1034999/archive/2007/04/08/109265.html</link><dc:creator>xsm</dc:creator><author>xsm</author><pubDate>Sun, 08 Apr 2007 12:34:00 GMT</pubDate><guid>http://www.blogjava.net/xsm1034999/archive/2007/04/08/109265.html</guid><wfw:comment>http://www.blogjava.net/xsm1034999/comments/109265.html</wfw:comment><comments>http://www.blogjava.net/xsm1034999/archive/2007/04/08/109265.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/xsm1034999/comments/commentRss/109265.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/xsm1034999/services/trackbacks/109265.html</trackback:ping><description><![CDATA[
		<font color="#000000">今天试了一下DAO＋Hibernate，还不错，很方便。<br />倒是遇到了一个问题：就是使用findByProperty(String propertyName, Object value)<br /></font>
		<br />事实上，他的第一个参数是属性名，第二个参数是值；<br />需要注意的是如果在设置参数的时候直接传属性将会报错，提示找不到这个属性<br />解决的方法是：在×.hbm.xml映射文件里，有一个配置<font color="#000000">&lt;composite-id name=“dd”,假如你的POJO属性名是xx，那么第一个参数应该是dd.xx<br /></font><br /><br /><img src ="http://www.blogjava.net/xsm1034999/aggbug/109265.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/xsm1034999/" target="_blank">xsm</a> 2007-04-08 20:34 <a href="http://www.blogjava.net/xsm1034999/archive/2007/04/08/109265.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一个普通大学生有感</title><link>http://www.blogjava.net/xsm1034999/archive/2007/04/07/109129.html</link><dc:creator>xsm</dc:creator><author>xsm</author><pubDate>Sat, 07 Apr 2007 10:32:00 GMT</pubDate><guid>http://www.blogjava.net/xsm1034999/archive/2007/04/07/109129.html</guid><wfw:comment>http://www.blogjava.net/xsm1034999/comments/109129.html</wfw:comment><comments>http://www.blogjava.net/xsm1034999/archive/2007/04/07/109129.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/xsm1034999/comments/commentRss/109129.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/xsm1034999/services/trackbacks/109129.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 作为一个普通本科生，今年已经是大三了，也是时候想一些东西并结论一些东西了。<br>&nbsp;&nbsp;<a href='http://www.blogjava.net/xsm1034999/archive/2007/04/07/109129.html'>阅读全文</a><img src ="http://www.blogjava.net/xsm1034999/aggbug/109129.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/xsm1034999/" target="_blank">xsm</a> 2007-04-07 18:32 <a href="http://www.blogjava.net/xsm1034999/archive/2007/04/07/109129.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JBuilder2005+ JBoss 开发CMP学习笔记</title><link>http://www.blogjava.net/xsm1034999/archive/2006/12/20/89017.html</link><dc:creator>xsm</dc:creator><author>xsm</author><pubDate>Wed, 20 Dec 2006 05:01:00 GMT</pubDate><guid>http://www.blogjava.net/xsm1034999/archive/2006/12/20/89017.html</guid><wfw:comment>http://www.blogjava.net/xsm1034999/comments/89017.html</wfw:comment><comments>http://www.blogjava.net/xsm1034999/archive/2006/12/20/89017.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/xsm1034999/comments/commentRss/89017.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/xsm1034999/services/trackbacks/89017.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 关于使用JB+JBoss开发CMP的详细步骤&nbsp;&nbsp;<a href='http://www.blogjava.net/xsm1034999/archive/2006/12/20/89017.html'>阅读全文</a><img src ="http://www.blogjava.net/xsm1034999/aggbug/89017.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/xsm1034999/" target="_blank">xsm</a> 2006-12-20 13:01 <a href="http://www.blogjava.net/xsm1034999/archive/2006/12/20/89017.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>我学习JAVA的心得</title><link>http://www.blogjava.net/xsm1034999/archive/2006/12/20/89009.html</link><dc:creator>xsm</dc:creator><author>xsm</author><pubDate>Wed, 20 Dec 2006 04:14:00 GMT</pubDate><guid>http://www.blogjava.net/xsm1034999/archive/2006/12/20/89009.html</guid><wfw:comment>http://www.blogjava.net/xsm1034999/comments/89009.html</wfw:comment><comments>http://www.blogjava.net/xsm1034999/archive/2006/12/20/89009.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.blogjava.net/xsm1034999/comments/commentRss/89009.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/xsm1034999/services/trackbacks/89009.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: －－送给那些初学JAVA的人们作参考！&nbsp;&nbsp;<a href='http://www.blogjava.net/xsm1034999/archive/2006/12/20/89009.html'>阅读全文</a><img src ="http://www.blogjava.net/xsm1034999/aggbug/89009.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/xsm1034999/" target="_blank">xsm</a> 2006-12-20 12:14 <a href="http://www.blogjava.net/xsm1034999/archive/2006/12/20/89009.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JAVA类装载器</title><link>http://www.blogjava.net/xsm1034999/archive/2006/12/20/88998.html</link><dc:creator>xsm</dc:creator><author>xsm</author><pubDate>Wed, 20 Dec 2006 03:07:00 GMT</pubDate><guid>http://www.blogjava.net/xsm1034999/archive/2006/12/20/88998.html</guid><wfw:comment>http://www.blogjava.net/xsm1034999/comments/88998.html</wfw:comment><comments>http://www.blogjava.net/xsm1034999/archive/2006/12/20/88998.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/xsm1034999/comments/commentRss/88998.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/xsm1034999/services/trackbacks/88998.html</trackback:ping><description><![CDATA[
		<div class="postcontent">
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">顾名思义，类装载器是用来把类</span>
						<span lang="EN-US">(class)</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">装载进</span>
						<span lang="EN-US">JVM</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的。</span>
						<span lang="EN-US">JVM</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">规范定义了两种类型的类装载器：<span style="COLOR: blue">启动内装载器</span></span>
						<span lang="EN-US" style="COLOR: blue">(bootstrap)</span>
						<span style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和用户自定义装载器</span>
						<span lang="EN-US" style="COLOR: blue">(user-defined class loader)</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">
								<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /?>
								<o:p> </o:p>
						</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US" style="COLOR: black; FONT-FAMILY: Arial">JVM</span>
						<span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的类动态装载技术能够在运行时刻动态地加载或者替换系统的某些功能模块</span>
						<span lang="EN-US" style="COLOR: black; FONT-FAMILY: Arial">, </span>
						<span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">而不影响系统其他功能模块的正常运行。</span>
						<span lang="EN-US" style="COLOR: black">
								<o:p>
								</o:p>
						</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US" style="COLOR: black">
								<o:p> </o:p>
						</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">装载就是寻找一个类或是一个接口的二进制形式并用该二进制形式来构造代表这个类或是这个接口的</span>
						<span lang="EN-US" style="COLOR: black; FONT-FAMILY: Arial">class</span>
						<span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象的过程，其中类或接口的名称是给定了的。当然名称也可以通过计算得到，但是更常见的是通过搜索源代码经过编译器编译后所得到的二进制形式来构造。</span>
						<span lang="EN-US" style="FONT-SIZE: 9.5pt; COLOR: black; FONT-FAMILY: Arial">
								<br />
								<br />
						</span>
						<span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">　　在</span>
						<span lang="EN-US" style="COLOR: black; FONT-FAMILY: Arial">Java</span>
						<span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中，类装载器把一个类装入</span>
						<span lang="EN-US" style="COLOR: black; FONT-FAMILY: Arial">Java</span>
						<span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">虚拟机中，要经过</span>
						<span style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">三个步骤</span>
						<span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">来完成：装载、链接和初始化，其中链接又可以分成校验、准备和解析三步，除了解析外，其它步骤是严格按照顺序完成的，各个步骤的主要工作如下：</span>
						<span lang="EN-US" style="FONT-SIZE: 9.5pt; COLOR: black; FONT-FAMILY: Arial">
								<br />
								<br />
						</span>
						<span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">　　装载：查找和导入类或接口的二进制数据；</span>
						<span style="COLOR: black; FONT-FAMILY: Arial">
						</span>
						<span lang="EN-US" style="FONT-SIZE: 9.5pt; COLOR: black; FONT-FAMILY: Arial">
								<br />
								<br />
						</span>
						<span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">　　链接：执行下面的校验、准备和解析步骤，其中解析步骤是可以选择的；</span>
						<span style="COLOR: black; FONT-FAMILY: Arial">
						</span>
						<span lang="EN-US" style="FONT-SIZE: 9.5pt; COLOR: black; FONT-FAMILY: Arial">
								<br />
								<br />
						</span>
						<span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">　　校验：检查导入类或接口的二进制数据的正确性；</span>
						<span style="COLOR: black; FONT-FAMILY: Arial">
						</span>
						<span lang="EN-US" style="FONT-SIZE: 9.5pt; COLOR: black; FONT-FAMILY: Arial">
								<br />
								<br />
						</span>
						<span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">　　准备：给类的静态变量分配并初始化存储空间；</span>
						<span style="COLOR: black; FONT-FAMILY: Arial">
						</span>
						<span lang="EN-US" style="FONT-SIZE: 9.5pt; COLOR: black; FONT-FAMILY: Arial">
								<br />
								<br />
						</span>
						<span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">　　解析：将符号引用转成直接引用；</span>
						<span style="COLOR: black; FONT-FAMILY: Arial">
						</span>
						<span lang="EN-US" style="FONT-SIZE: 9.5pt; COLOR: black; FONT-FAMILY: Arial">
								<br />
								<br />
						</span>
						<span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">　　初始化：激活类的静态变量的初始化</span>
						<span lang="EN-US" style="COLOR: black; FONT-FAMILY: Arial">Java</span>
						<span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">代码和静态</span>
						<span lang="EN-US" style="COLOR: black; FONT-FAMILY: Arial">Java</span>
						<span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">代码块。</span>
						<span lang="EN-US" style="COLOR: black">
								<o:p>
								</o:p>
						</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">
								<o:p> </o:p>
						</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">bootstrap</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是</span>
						<span lang="EN-US">JVM</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">自带的类装载器，用来装载核心类库，如</span>
						<span lang="EN-US">java.lang.*</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">等。由例</span>
						<span lang="EN-US">1</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">可以看出，</span>
						<span lang="EN-US">java.lang.Object</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是由</span>
						<span lang="EN-US">bootstrap</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">装载的。</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">
								<o:p> </o:p>
						</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">Java</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">提供了抽象类</span>
						<span lang="EN-US">ClassLoader</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，所有用户自定义类装载器都实例化自</span>
						<span lang="EN-US">ClassLoader</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的子类。</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">System Class Loader</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是一个特殊的用户自定义类装载器，由</span>
						<span lang="EN-US">JVM</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的实现者提供，在编程者不特别指定装载器的情况下默认装载用户类。系统类装载器可以通过</span>
						<span lang="EN-US">ClassLoader.getSystemClassLoader() </span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法得到。</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">
								<o:p> </o:p>
						</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">例</span>
						<span lang="EN-US">1</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，测试你所使用的</span>
						<span lang="EN-US">JVM</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的</span>
						<span lang="EN-US">ClassLoader</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">/*LoaderSample1.java*/</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">public class LoaderSample1</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">{</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">
								<span style="mso-tab-count: 1">       </span>public static void main(String[] args)</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">
								<span style="mso-tab-count: 1">       </span>{</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">
								<span style="mso-tab-count: 2">              </span>Class c;</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">
								<span style="mso-tab-count: 2">              </span>ClassLoader cl;</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">
								<span style="mso-tab-count: 2">              </span>
						</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">
								<span style="mso-tab-count: 2">              </span>cl = ClassLoader.getSystemClassLoader();</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">
								<span style="mso-tab-count: 2">              </span>System.out.println(cl);</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">
								<span style="mso-tab-count: 2">              </span>
						</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">
								<span style="mso-tab-count: 2">              </span>while (cl != null)</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">
								<span style="mso-tab-count: 2">              </span>{</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">
								<span style="mso-tab-count: 3">                     </span>cl = cl.getParent();</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">
								<span style="mso-tab-count: 3">                     </span>System.out.println(cl);<span style="mso-tab-count: 2">          </span></span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">
								<span style="mso-tab-count: 2">              </span>}</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">
								<o:p> </o:p>
						</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">
								<span style="mso-tab-count: 2">              </span>try</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">
								<span style="mso-tab-count: 1">       </span>
								<span style="mso-tab-count: 1">       </span>{</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">
								<span style="mso-tab-count: 3">                     </span>
						</span>
						<span lang="PT-BR" style="mso-ansi-language: PT-BR">c = Class.forName(“java.lang.Object”);<o:p></o:p></span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="PT-BR" style="mso-ansi-language: PT-BR">
								<span style="mso-tab-count: 3">                     </span>cl = c.getClassLoader();<o:p></o:p></span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="PT-BR" style="mso-ansi-language: PT-BR">
								<span style="mso-tab-count: 3">                     </span>
						</span>
						<span lang="EN-US">System.out.println(“java.lang.Object’s loader is ” + cl);</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">
								<o:p> </o:p>
						</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">
								<span style="mso-tab-count: 3">                     </span>c = Class.forName(“LoaderSample1”);</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt">
						<span lang="EN-US">cl = c.getClassLoader();</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">
								<span style="mso-tab-count: 3">                     </span>System.out.println(“LoaderSample1’s loader is ” + cl);</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">
								<span style="mso-tab-count: 2">              </span>
						</span>
						<span lang="PT-BR" style="mso-ansi-language: PT-BR">}<o:p></o:p></span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="PT-BR" style="mso-ansi-language: PT-BR">
								<span style="mso-tab-count: 2">              </span>catch (Exception e)<o:p></o:p></span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="PT-BR" style="mso-ansi-language: PT-BR">
								<span style="mso-tab-count: 2">              </span>{<o:p></o:p></span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="PT-BR" style="mso-ansi-language: PT-BR">
								<span style="mso-tab-count: 3">                     </span>e.printStackTrace();<o:p></o:p></span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt">
						<span lang="PT-BR" style="mso-ansi-language: PT-BR">} <o:p></o:p></span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="PT-BR" style="mso-ansi-language: PT-BR">
								<span style="mso-tab-count: 1">       </span>
						</span>
						<span lang="EN-US">}</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">}</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">
								<o:p> </o:p>
						</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-ansi-language: PT-BR">在我的机器上</span>
						<span lang="PT-BR" style="mso-ansi-language: PT-BR">(Sun Java 1.4.2)</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-ansi-language: PT-BR">的</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">运行结果</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">sun.misc.Launcher$AppClassLoader@1a0c10f</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">sun.misc.Launcher$ExtClassLoader@e2eec8</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">null </span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">java.lang.Object's loader is null</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">LoaderSample1's loader is sun.misc.Launcher$AppClassLoader@1a0c10f</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span lang="EN-US">
								<o:p> </o:p>
						</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">第一行表示，系统类装载器实例化自类</span>
						<span lang="EN-US">sun.misc.Launcher$AppClassLoader</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">第二行表示，系统类装载器的</span>
						<span lang="EN-US">parent</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">实例化自类</span>
						<span lang="EN-US">sun.misc.Launcher$ExtClassLoader</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">第三行表示，系统类装载器</span>
						<span lang="EN-US">parent</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的</span>
						<span lang="EN-US">parent</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">为</span>
						<span lang="EN-US">bootstrap</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">第四行表示，核心类</span>
						<span lang="EN-US">java.lang.Object</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是由</span>
						<span lang="EN-US">bootstrap</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">装载的</span>
				</p>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">第五行表示，用户类</span>
						<span lang="EN-US">LoaderSample1</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是由系统类装载器装载的</span>
				</p>
		</div>
<img src ="http://www.blogjava.net/xsm1034999/aggbug/88998.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/xsm1034999/" target="_blank">xsm</a> 2006-12-20 11:07 <a href="http://www.blogjava.net/xsm1034999/archive/2006/12/20/88998.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>关于Java栈与堆的思考</title><link>http://www.blogjava.net/xsm1034999/archive/2006/12/20/88996.html</link><dc:creator>xsm</dc:creator><author>xsm</author><pubDate>Wed, 20 Dec 2006 03:04:00 GMT</pubDate><guid>http://www.blogjava.net/xsm1034999/archive/2006/12/20/88996.html</guid><wfw:comment>http://www.blogjava.net/xsm1034999/comments/88996.html</wfw:comment><comments>http://www.blogjava.net/xsm1034999/archive/2006/12/20/88996.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/xsm1034999/comments/commentRss/88996.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/xsm1034999/services/trackbacks/88996.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 1. 				栈						(stack)				与堆						(heap)				都是																				Java														用来在						Ram				中存放数据的地方。与																				C++										...&nbsp;&nbsp;<a href='http://www.blogjava.net/xsm1034999/archive/2006/12/20/88996.html'>阅读全文</a><img src ="http://www.blogjava.net/xsm1034999/aggbug/88996.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/xsm1034999/" target="_blank">xsm</a> 2006-12-20 11:04 <a href="http://www.blogjava.net/xsm1034999/archive/2006/12/20/88996.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>