﻿<?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-hegen</title><link>http://www.blogjava.net/hegen/</link><description /><language>zh-cn</language><lastBuildDate>Tue, 28 Apr 2026 19:01:47 GMT</lastBuildDate><pubDate>Tue, 28 Apr 2026 19:01:47 GMT</pubDate><ttl>60</ttl><item><title>  java.lang.NullPointerException</title><link>http://www.blogjava.net/hegen/archive/2005/08/25/11032.html</link><dc:creator>hegen</dc:creator><author>hegen</author><pubDate>Thu, 25 Aug 2005 05:43:00 GMT</pubDate><guid>http://www.blogjava.net/hegen/archive/2005/08/25/11032.html</guid><wfw:comment>http://www.blogjava.net/hegen/comments/11032.html</wfw:comment><comments>http://www.blogjava.net/hegen/archive/2005/08/25/11032.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hegen/comments/commentRss/11032.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hegen/services/trackbacks/11032.html</trackback:ping><description><![CDATA[&nbsp;
<DL>
<DT>public class <B>NullPointerException</B> 
<DT>extends <A href="http://www.leftworld.net/online/j2sedoc/javaref/java.lang.runtimeexception_dsc.htm#_top_">RuntimeException</A> </DT></DL>
<P>当一个应用在需要一个对象的地方试图使用 <CODE>null</CODE> 时抛出。它们包括： 
<UL>
<LI>调用一个 <CODE>null</CODE> 对象的实例方法。 
<LI>访问或修改一个 <CODE>null</CODE> 对象的域。 
<LI>将 <CODE>null</CODE> 作为一个数组，使用它的长度。 
<LI>将 <CODE>null</CODE> 作为一个数组，访问或修改它的插口。 
<LI>将 <CODE>null</CODE> 作为一个 <CODE>Throwable</CODE> 值抛出。 </LI></UL>
<P>应用应该抛出该类的实例，指示其它对 <CODE>null</CODE> 对象的非法使用。<BR>
<HR>

<HR>
<BR><BR><BR></P>
<H4>构造子索引 </H4>
<DL>
<DT><A href="http://www.leftworld.net/online/j2sedoc/javaref/java.lang.nullpointerexception_dsc.htm#NullPointerException()">NullPointerException</A>() 
<DD>构造一个没有详细消息的 <CODE>NullPointerException</CODE>。 
<DT><A href="http://www.leftworld.net/online/j2sedoc/javaref/java.lang.nullpointerexception_dsc.htm#NullPointerException(java.lang.String)">NullPointerException</A>(String) 
<DD>构造一个具有指定详细消息的 <CODE>NullPointerException<BR><BR><BR>
<HR>

<HR>

<H4>构造子 </H4><A name=NullPointerException></A><A name=NullPointerException()></A><B>NullPointerException</B> <PRE> public NullPointerException()
</PRE>
<DL>
<DD>构造一个没有详细消息的 <CODE>NullPointerException</CODE>。 
<P></P></DD></DL><A name=NullPointerException(java.lang.String)></A><B>NullPointerException</B> <PRE> public NullPointerException(<A href="http://www.leftworld.net/online/j2sedoc/javaref/java.lang.string_dsc.htm#_top_">String</A> s)
</PRE>
<DL>
<DD>构造一个具有指定详细消息的 <CODE>NullPointerException</CODE>。 
<P></P>
<DD>
<DL>
<DT><B>参数：</B> 
<DD>s - 详细消息。 </DD></DL></DD></DL><BR></CODE></DD></DL><img src ="http://www.blogjava.net/hegen/aggbug/11032.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hegen/" target="_blank">hegen</a> 2005-08-25 13:43 <a href="http://www.blogjava.net/hegen/archive/2005/08/25/11032.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>thinking </title><link>http://www.blogjava.net/hegen/archive/2005/08/25/10967.html</link><dc:creator>hegen</dc:creator><author>hegen</author><pubDate>Wed, 24 Aug 2005 18:14:00 GMT</pubDate><guid>http://www.blogjava.net/hegen/archive/2005/08/25/10967.html</guid><wfw:comment>http://www.blogjava.net/hegen/comments/10967.html</wfw:comment><comments>http://www.blogjava.net/hegen/archive/2005/08/25/10967.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hegen/comments/commentRss/10967.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hegen/services/trackbacks/10967.html</trackback:ping><description><![CDATA[　Single inheritance precludes some useful and correct designs.The problems of multiple inheritance arise from multiple inheritance of implememtion, but in many cases multiple inheritance is used to inhert a number of abstract contracts and perhaps one concrete implementtation.Providing a means to inherit an abstract contract without inheriting an implementation allows the typing benefits of multiple inheritance without the problems of multiple implementation inheritance.The inheritance of an abstract contract is termed interface inhertiance.<img src ="http://www.blogjava.net/hegen/aggbug/10967.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hegen/" target="_blank">hegen</a> 2005-08-25 02:14 <a href="http://www.blogjava.net/hegen/archive/2005/08/25/10967.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>稳扎稳打才是真</title><link>http://www.blogjava.net/hegen/archive/2005/08/18/10385.html</link><dc:creator>hegen</dc:creator><author>hegen</author><pubDate>Wed, 17 Aug 2005 16:44:00 GMT</pubDate><guid>http://www.blogjava.net/hegen/archive/2005/08/18/10385.html</guid><wfw:comment>http://www.blogjava.net/hegen/comments/10385.html</wfw:comment><comments>http://www.blogjava.net/hegen/archive/2005/08/18/10385.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hegen/comments/commentRss/10385.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hegen/services/trackbacks/10385.html</trackback:ping><description><![CDATA[　看完了<STRONG>程功的故事后，感到只有稳扎稳打才是真，只有努力才能成功，</STRONG>我是笨鸟，笨鸟只有以勤补拙，笨鸟是要先飞的．<img src ="http://www.blogjava.net/hegen/aggbug/10385.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hegen/" target="_blank">hegen</a> 2005-08-18 00:44 <a href="http://www.blogjava.net/hegen/archive/2005/08/18/10385.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Garbage Collection</title><link>http://www.blogjava.net/hegen/archive/2005/08/11/9805.html</link><dc:creator>hegen</dc:creator><author>hegen</author><pubDate>Thu, 11 Aug 2005 05:46:00 GMT</pubDate><guid>http://www.blogjava.net/hegen/archive/2005/08/11/9805.html</guid><wfw:comment>http://www.blogjava.net/hegen/comments/9805.html</wfw:comment><comments>http://www.blogjava.net/hegen/archive/2005/08/11/9805.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hegen/comments/commentRss/9805.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hegen/services/trackbacks/9805.html</trackback:ping><description><![CDATA[Garbage Collection <BR>State the behavior that is guaranteed by the garbage collection system and write code that explicitly makes objects eligible for collection. <BR>1.&nbsp;&nbsp;&nbsp;&nbsp;Garbage collection is a mechanism for reclaiming memory from objects that are no longer in use, and making the memory available for new objects.<BR>2.&nbsp;&nbsp;&nbsp;&nbsp;An object being no longer in use means that it can’t be referenced by any ‘active’ part of the program.<BR>3.&nbsp;&nbsp;&nbsp;&nbsp;Garbage collection runs in a low priority thread. It may kick in when memory is too low. No guarantee.<BR>4.&nbsp;&nbsp;&nbsp;&nbsp;It’s not possible to force garbage collection. Invoking System.gc may start garbage collection process.<BR>5.&nbsp;&nbsp;&nbsp;&nbsp;There are no guarantees that the objects no longer in use will be garbage collected and their finalizers executed at all. gc might not even be run if the program execution does not warrant it. Thus any memory allocated during program execution might remain allocated after program termination, unless reclaimed by the OS or by other means.<BR>6.&nbsp;&nbsp;&nbsp;&nbsp;There are also no guarantees on the order in which the objects will be garbage collected or on the order in which the finalizers are called. <BR>7.&nbsp;&nbsp;&nbsp;&nbsp;Circular references do not prevent objects from being garbage collected.<BR>8.&nbsp;&nbsp;&nbsp;&nbsp;We can set the reference variables to null, hinting the gc to garbage collect the objects referred by the variables. Even if we do that, the object may not be gc-ed if it’s attached to a listener. (Typical in case of AWT components) Remember to remove the listener first.<BR>9.&nbsp;&nbsp;&nbsp;&nbsp;All objects have a finalize method. It is inherited from the Object class.<BR>10.&nbsp;&nbsp;&nbsp;&nbsp;finalize method is used to release system resources other than memory. (such as file handles and network connections) The order in which finalize methods are called may not reflect the order in which objects are created. Don’t rely on it. This is the signature of the finalize method.<BR>protected void finalize() throws Throwable { }<BR>In the descendents this method can be protected or public. Descendents can restrict the exception list that can be thrown by this method. <BR>11.&nbsp;&nbsp;&nbsp;&nbsp;finalize is called only once for an object. If any exception is thrown in finalize, the object is still eligible for garbage collection (at the discretion of gc)<BR>12.&nbsp;&nbsp;&nbsp;&nbsp;gc keeps track of unreachable objects and garbage-collects them, but an unreachable object can become reachable again by letting know other objects of its existence from its finalize method (when called by gc). This ‘resurrection’ can be done only once, since finalize is called only one for an object.<BR>13.&nbsp;&nbsp;&nbsp;&nbsp;finalize can be called explicitly, but it does not garbage collect the object.<BR>14.&nbsp;&nbsp;&nbsp;&nbsp;finalize can be overloaded, but only the method with original finalize signature will be called by gc.<BR>15.&nbsp;&nbsp;&nbsp;&nbsp;finalize is not implicitly chained. A finalize method in sub-class should call finalize in super class explicitly as its last action for proper functioning. But compiler doesn’t enforce this check.<BR>16.&nbsp;&nbsp;&nbsp;&nbsp;System.runFinalization can be used to run the finalizers (which have not been executed before) for the objects eligible for garbage collection.<BR>17.&nbsp;&nbsp;&nbsp;&nbsp;Local variables in methods go out of scope when the method exits. At this point the methods are eligible for garbage collection. Each time the method comes into scope the local variables are re-created.&nbsp;&nbsp;<BR>18.&nbsp;&nbsp;&nbsp;&nbsp;Java uses a "mark sweep garbage collection algorithm, which traverses all the object references, marking any objects that are referred to and then garbage collecting any objects that are unmarked.<BR>19.&nbsp;&nbsp;&nbsp;&nbsp;Java allows you to add a finalize() method to any class. The finalize() method will be called before the garbage collector sweeps away the object. In practice, do not rely on the finalize method for recycling any resources that are in short supply - you simply cannot know when this method will be called.<BR><BR>
<HR>
In the exam point of view :<BR>You must be able to identify when an object is available for gc - you have either set it to null or you<BR>have "redirected" the variable that was originally referring to it, so that it now refers to a different<BR>object.<BR>if you have a reference to an object say, A and then you pass A as an argument to some constructor -<BR>new obj(A); - then even if you null your reference - A=null; - you can't say that A is available for<BR>gc. So just follow the references and when they drop to zero you know its eligible/available for gc,<BR>not that it will happen.<BR>
<HR>
<BR><STRONG><FONT color=#ff0000 size=6>I can not full understand these statements which are above.<BR></FONT></STRONG>
<HR>
<BR><BR><FONT color=#ff0000>eg,</FONT><BR>1. obj = new Jo();<BR>2. obj.doSomething();<BR>3. obj = new Jo(); //Same as obj=null;<BR>4. obj.doSomething();<BR><BR>Object a = new Object();<BR>Object a=null; //Now the object created in 1st line is available for gc<BR>Object a=new Object();<BR>a = new Object(); //same.<BR>// Now original object created in line 1 is available for gc and a new<BR>object is now out there referenced by "a".<BR><BR>Aclass a = new Aclass(); // Object 1<BR>Aclass b= new Aclass(); // Object 2<BR>Aclass c = new Aclass(); // Object 3<BR>a=b; // now we have no valid object reference to object "a" and it will be<BR>// garbage collected sometime after this statement. But when?......<BR>a=c;<BR>c=null; // no garbage collection will be eligible since<BR>// "a" still refers to Object 3<BR>a=null; // now object "c" is eligible for gc since it always had a valid reference.<BR>// Should "b" go out of scope; then we would possibly have eligibility for gc.<BR>// there might still be other references to object "b" preventing the collection.<BR><img src ="http://www.blogjava.net/hegen/aggbug/9805.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hegen/" target="_blank">hegen</a> 2005-08-11 13:46 <a href="http://www.blogjava.net/hegen/archive/2005/08/11/9805.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Some Text Color</title><link>http://www.blogjava.net/hegen/archive/2005/08/10/9742.html</link><dc:creator>hegen</dc:creator><author>hegen</author><pubDate>Wed, 10 Aug 2005 12:48:00 GMT</pubDate><guid>http://www.blogjava.net/hegen/archive/2005/08/10/9742.html</guid><wfw:comment>http://www.blogjava.net/hegen/comments/9742.html</wfw:comment><comments>http://www.blogjava.net/hegen/archive/2005/08/10/9742.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hegen/comments/commentRss/9742.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hegen/services/trackbacks/9742.html</trackback:ping><description><![CDATA[<H2>Text Color Codes</H2>In order to change text colors, you will need two things: 
<P><B>1. A command to change the text.</B><BR><B>2. A color (hex) code. 
<HR>
</B>
<P></P>Changing Full-Page Text Colors<I>You have the ability to change full-page text colors over four levels:</I> 
<P>
<CENTER></CENTER><FONT color=#800000>&lt;TEXT="######"&gt;</FONT> -- This denotes the full-page text color.<BR><BR><FONT color=#800000>&lt;LINK="######"&gt;</FONT> -- This denotes the color of the links on your page.<BR><BR><FONT color=#800000>&lt;ALINK="######"&gt;</FONT> -- This denotes the color the link will <A class=iAs style="COLOR: darkgreen; BORDER-BOTTOM: darkgreen 1px solid; BACKGROUND-COLOR: transparent; TEXT-DECORATION: underline" href="http://www.htmlgoodies.com/tutorials/colors/article.php/3479011#" target=_blank>flash</A> when clicked upon.<BR><BR><FONT color=#800000>&lt;VLINK="######"&gt;</FONT> -- This denotes the colors of the links after they have been visited. 
<CENTER>
<P>These commands come right after the &lt;TITLE&gt; commands. Again, in that position they affect everything on the page. <B>Also...</B> place them all together inside the same command along with any <A href="http://www.htmlgoodies.com/tutors/backgrnd.html"><FONT color=#002c99>background</FONT></A> commands. Something like this: 
<P><FONT color=#800000 size=-1>&lt; BODY BGCOLOR="######" TEXT="######" LINK="######" VLINK="######"&gt;</FONT></B><BR><BR><B>Please note:</B> When you write these codes, you can write them with a # sign in front of the hex code or not. It used to be that that was required, but not any more. I still use it just because I started that way. You may want to just go with the six-digit code. Also make sure to place a space between each command and be sure to enclose it in quotation marks, like so: 
<P align=left><B><FONT color=#800000>&lt;VLINK="#FFFFFF"&gt;</FONT></B> <BR><BR>问题：<BR>　　上面的那几个东西还没有搞懂．不知道什么用？<BR></P>
<HR>
Changing Specific Word ColorBut I only want to <FONT color=#00ff00>change</FONT> <FONT color=#000000>one</FONT> <FONT color=#ff0000>word's</FONT> <FONT color=#0060ff>color</FONT>! 
<P></P>
<P><B>You'll use a color (hex) code to do the trick. Follow this formula:</B> 
<P>
<CENTER><FONT color=#800000 size=-1>&lt;FONT COLOR="######"&gt;<FONT color=#00ff00>text text text text text</FONT>&lt;/FONT&gt;</FONT></B> 
<P>It's a pain in the you-know-where, but it gets the job done. It works with all H commands and text size commands. Basically, if it's text, it will work.</P><BR></CENTER></CENTER><img src ="http://www.blogjava.net/hegen/aggbug/9742.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hegen/" target="_blank">hegen</a> 2005-08-10 20:48 <a href="http://www.blogjava.net/hegen/archive/2005/08/10/9742.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>A Basic Color Code</title><link>http://www.blogjava.net/hegen/archive/2005/08/10/9741.html</link><dc:creator>hegen</dc:creator><author>hegen</author><pubDate>Wed, 10 Aug 2005 12:37:00 GMT</pubDate><guid>http://www.blogjava.net/hegen/archive/2005/08/10/9741.html</guid><wfw:comment>http://www.blogjava.net/hegen/comments/9741.html</wfw:comment><comments>http://www.blogjava.net/hegen/archive/2005/08/10/9741.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hegen/comments/commentRss/9741.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hegen/services/trackbacks/9741.html</trackback:ping><description><![CDATA[<P><FONT size=-1><B>Please note</B>:<BR>"Aqua" and "Cyan" produce the same color: 00FFFF <BR>"Fuchsia" and "Magenta" produce the same color: FF00FF</FONT> 
<CENTER></CENTER>
<P>
<CENTER>
<TABLE cellSpacing=1 cellPadding=1 width=340 border=1>
<TBODY>
<TR>
<TD align=middle width="15%" bgColor=aliceblue>Aliceblue<BR>F0F8FF </TD>
<TD align=middle width="15%" bgColor=antiquewhite>Antiquewhite<BR>FAEBD7 </TD>
<TD align=middle width="15%" bgColor=aqua>Aqua<BR>00FFFF 
<TR>
<TD align=middle width="15%" bgColor=aquamarine>Aquamarine<BR>7FFFD4 </TD>
<TD align=middle width="15%" bgColor=azure>Azure<BR>F0FFFF<BR></TD>
<TD align=middle width="15%" bgColor=beige>Beige<BR>F5F5DC 
<TR>
<TD align=middle width="15%" bgColor=bisque>Bisque<BR>FFE4C4 </TD>
<TD align=middle width="15%" bgColor=black><FONT color=#ffffff>Black<BR>000000</FONT> </TD>
<TD align=middle width="15%" bgColor=blanchedalmond>Blanchedalmond<BR>FFEBCD 
<TR>
<TD align=middle width="15%" bgColor=blue>Blue<BR>0000FF </TD>
<TD align=middle width="15%" bgColor=#b000e0>Blueviolet<BR>8A2BE2 </TD>
<TD align=middle width="15%" bgColor=brown>Brown<BR>A52A2A 
<TR>
<TD align=middle width="15%" bgColor=burlywood>Burlywood<BR>DEB887 </TD>
<TD align=middle width="15%" bgColor=cadetblue>Cadetblue<BR>5F9EA0 </TD>
<TD align=middle width="15%" bgColor=chartreuse>Chartreuse<BR>7FFF00 
<TR>
<TD align=middle width="15%" bgColor=chocolate>Chocolate<BR>D2691E </TD>
<TD align=middle width="15%" bgColor=coral>Coral<BR>FF7F50 </TD>
<TD align=middle width="15%" bgColor=cornflowerblue>Cornflowerblue<BR>6495ED 
<TR>
<TD align=middle width="15%" bgColor=cornsilk>Cornsilk<BR>FFF8DC </TD>
<TD align=middle width="15%" bgColor=crimson>Crimson<BR>DC143C </TD>
<TD align=middle width="15%" bgColor=cyan>Cyan<BR>00FFFF 
<TR>
<TD align=middle width="15%" bgColor=darkblue>Darkblue<BR>00008B </TD>
<TD align=middle width="15%" bgColor=darkcyan>Darkcyan<BR>008B8B </TD>
<TD align=middle width="15%" bgColor=darkgoldenrod>Darkgoldenrod<BR>B8860B 
<TR>
<TD align=middle width="15%" bgColor=darkgray>Darkgray<BR>A9A9A9 </TD>
<TD align=middle width="15%" bgColor=darkgreen>Darkgreen<BR>006400 </TD>
<TD align=middle width="15%" bgColor=darkkhaki>Darkkhaki<BR>BDB76B 
<TR>
<TD align=middle width="15%" bgColor=darkmagenta>Darkmagenta<BR>8B008B </TD>
<TD align=middle width="15%" bgColor=darkolivegreen>Darkolivegreen<BR>556B2F </TD>
<TD align=middle width="15%" bgColor=darkorange>Darkorange<BR>FF8C00 
<TR>
<TD align=middle width="15%" bgColor=darkorchid>Darkorchid<BR>9932CC </TD>
<TD align=middle width="15%" bgColor=darkred>Darkred<BR>8B0000 </TD>
<TD align=middle width="15%" bgColor=darksalmon>Darksalmon<BR>E9967A 
<TR>
<TD align=middle width="15%" bgColor=darkseagreen>Darkseagreen<BR>8FBC8F </TD>
<TD align=middle width="15%" bgColor=darkslateblue>Darkslateblue<BR>483D8B </TD>
<TD align=middle width="15%" bgColor=darkslategray>Darkslategray<BR>2F4F4F 
<TR>
<TD align=middle width="15%" bgColor=darkturquoise>Darkturquoise<BR>00CED1 </TD>
<TD align=middle width="15%" bgColor=darkviolet>Darkviolet<BR>9400D3 </TD>
<TD align=middle width="15%" bgColor=deeppink>deeppink<BR>FF1493 
<TR>
<TD align=middle width="15%" bgColor=deepskyblue>Deepskyblue<BR>00BFFF </TD>
<TD align=middle width="15%" bgColor=dimgray>Dimgray<BR>696969 </TD>
<TD align=middle width="15%" bgColor=dodgerblue>Dodgerblue<BR>1E90FF 
<TR>
<TD align=middle width="15%" bgColor=firebrick>Firebrick<BR>B22222 </TD>
<TD align=middle width="15%" bgColor=floralwhite>Floralwhite<BR>FFFAF0 </TD>
<TD align=middle width="15%" bgColor=forestgreen>Forestgreen<BR>228B22 
<TR>
<TD align=middle width="15%" bgColor=fuchsia>Fuchsia<BR>FF00FF </TD>
<TD align=middle width="15%" bgColor=gainsboro>Gainsboro<BR>DCDCDC </TD>
<TD align=middle width="15%" bgColor=ghostwhite>Ghostwhite<BR>F8F8FF 
<TR>
<TD align=middle width="15%" bgColor=gold>Gold<BR>FFD700 </TD>
<TD align=middle width="15%" bgColor=goldenrod>Goldenrod<BR>DAA520 </TD>
<TD align=middle width="15%" bgColor=gray>Gray<BR>808080 
<TR>
<TD align=middle width="15%" bgColor=green>Green<BR>008000 </TD>
<TD align=middle width="15%" bgColor=greenyellow>Greenyellow<BR>ADFF2F </TD>
<TD align=middle width="15%" bgColor=honeydew>Honeydew<BR>F0FFF0 
<TR>
<TD align=middle width="15%" bgColor=hotpink>Hotpink<BR>FF69B4 </TD>
<TD align=middle width="15%" bgColor=indianred>Indianred<BR>CD5C5C </TD>
<TD align=middle width="15%" bgColor=indigo>Indigo<BR>4B0082 
<TR>
<TD align=middle width="15%" bgColor=ivory>Ivory<BR>FFFFF0 </TD>
<TD align=middle width="15%" bgColor=khaki>Khaki<BR>F0E68C </TD>
<TD align=middle width="15%" bgColor=lavender>Lavender<BR>E6E6FA 
<TR>
<TD align=middle width="15%" bgColor=lavenderblush>Lavenderblush<BR>FFF0F5 </TD>
<TD align=middle width="15%" bgColor=lawngreen>Lawngreen<BR>7CFC00 </TD>
<TD align=middle width="15%" bgColor=lemonchiffon>Lemonchiffon<BR>FFFACD 
<TR>
<TD align=middle width="15%" bgColor=lightblue>Lightblue<BR>ADD8E6 </TD>
<TD align=middle width="15%" bgColor=lightcoral>Lightcoral<BR>F08080 </TD>
<TD align=middle width="15%" bgColor=lightcyan>Lightcyan<BR>E0FFFF 
<TR>
<TD align=middle width="15%" bgColor=lightgoldenrodyellow>Lightgoldenrodyellow<BR>FAFAD2 </TD>
<TD align=middle width="15%" bgColor=lightgreen>Lightgreen<BR>90EE90 </TD>
<TD align=middle width="15%" bgColor=lightgrey>Lightgrey<BR>D3D3D3 
<TR>
<TD align=middle width="15%" bgColor=lightpink>Lightpink<BR>FFB6C1 </TD>
<TD align=middle width="15%" bgColor=lightsalmon>Lightsalmon<BR>FFA07A </TD>
<TD align=middle width="15%" bgColor=lightseagreen>Lightseagreen<BR>20B2AA 
<TR>
<TD align=middle width="15%" bgColor=lightskyblue>Lightskyblue<BR>87CEFA </TD>
<TD align=middle width="15%" bgColor=lightslategray>Lightslategray<BR>778899 </TD>
<TD align=middle width="15%" bgColor=lightsteelblue>Lightsteelblue<BR>B0C4DE 
<TR>
<TD align=middle width="15%" bgColor=lightyellow>Lightyellow<BR>FFFFE0 </TD>
<TD align=middle width="15%" bgColor=lime>Lime<BR>00FF00 </TD>
<TD align=middle width="15%" bgColor=limegreen>Limegreen<BR>32CD32 
<TR>
<TD align=middle width="15%" bgColor=linen>Linen<BR>FAF0E6 </TD>
<TD align=middle width="15%" bgColor=magenta>Magenta<BR>FF00FF </TD>
<TD align=middle width="15%" bgColor=maroon>Maroon<BR>800000 
<TR>
<TD align=middle width="15%" bgColor=mediumaquamarine>Mediumauqamarine<BR>66CDAA </TD>
<TD align=middle width="15%" bgColor=mediumblue>Mediumblue<BR>0000CD </TD>
<TD align=middle width="15%" bgColor=mediumorchid>Mediumorchid<BR>BA55D3 
<TR>
<TD align=middle width="15%" bgColor=mediumpurple>Mediumpurple<BR>9370D8 </TD>
<TD align=middle width="15%" bgColor=mediumseagreen>Mediumseagreen<BR>3CB371 </TD>
<TD align=middle width="15%" bgColor=mediumslateblue>Mediumslateblue<BR>7B68EE 
<TR>
<TD align=middle width="15%" bgColor=mediumspringgreen>Mediumspringgreen<BR>00FA9A </TD>
<TD align=middle width="15%" bgColor=mediumturquoise>Mediumturquoise<BR>48D1CC </TD>
<TD align=middle width="15%" bgColor=mediumvioletred>Mediumvioletred<BR>C71585 
<TR>
<TD align=middle width="15%" bgColor=midnightblue>Midnightblue<BR>191970 </TD>
<TD align=middle width="15%" bgColor=mintcream>Mintcream<BR>F5FFFA </TD>
<TD align=middle width="15%" bgColor=mistyrose>Mistyrose<BR>FFE4E1 
<TR>
<TD align=middle width="15%" bgColor=moccasin>Moccasin<BR>FFE4B5 </TD>
<TD align=middle width="15%" bgColor=navajowhite>Navajowhite<BR>FFDEAD </TD>
<TD align=middle width="15%" bgColor=navy>Navy<BR>000080 
<TR>
<TD align=middle width="15%" bgColor=oldlace>Oldlace<BR>FDF5E6 </TD>
<TD align=middle width="15%" bgColor=olive>Olive<BR>808000 </TD>
<TD align=middle width="15%" bgColor=olivedrab>Olivedrab<BR>688E23 
<TR>
<TD align=middle width="15%" bgColor=orange>Orange<BR>FFA500 </TD>
<TD align=middle width="15%" bgColor=orangered>Orangered<BR>FF4500 </TD>
<TD align=middle width="15%" bgColor=orchid>Orchid<BR>DA70D6 
<TR>
<TD align=middle width="15%" bgColor=palegoldenrod>Palegoldenrod<BR>EEE8AA </TD>
<TD align=middle width="15%" bgColor=palegreen>Palegreen<BR>98FB98 </TD>
<TD align=middle width="15%" bgColor=paleturquoise>Paleturquoise<BR>AFEEEE 
<TR>
<TD align=middle width="15%" bgColor=palevioletred>Palevioletred<BR>D87093 </TD>
<TD align=middle width="15%" bgColor=papayawhip>Papayawhip<BR>FFEFD5 </TD>
<TD align=middle width="15%" bgColor=peachpuff>Peachpuff<BR>FFDAB9 
<TR>
<TD align=middle width="15%" bgColor=peru>Peru<BR>CD853F </TD>
<TD align=middle width="15%" bgColor=pink>Pink<BR>FFC0CB </TD>
<TD align=middle width="15%" bgColor=plum>Plum<BR>DDA0DD 
<TR>
<TD align=middle width="15%" bgColor=powderblue>Powderblue<BR>B0E0E6 </TD>
<TD align=middle width="15%" bgColor=purple>Purple<BR>800080 </TD>
<TD align=middle width="15%" bgColor=red>Red<BR>FF0000 
<TR>
<TD align=middle width="15%" bgColor=rosybrown>Rosybrown<BR>BC8F8F </TD>
<TD align=middle width="15%" bgColor=royalblue>Royalblue<BR>4169E1 </TD>
<TD align=middle width="15%" bgColor=saddlebrown>Saddlebrown<BR>8B4513 
<TR>
<TD align=middle width="15%" bgColor=salmon>Salmon<BR>FA8072 </TD>
<TD align=middle width="15%" bgColor=sandybrown>Sandybrown<BR>F4A460 </TD>
<TD align=middle width="15%" bgColor=seagreen>Seagreen<BR>2E8B57 
<TR>
<TD align=middle width="15%" bgColor=seashell>Seashell<BR>FFF5EE </TD>
<TD align=middle width="15%" bgColor=sienna>Sienna<BR>A0522D </TD>
<TD align=middle width="15%" bgColor=silver>Silver<BR>C0C0C0 
<TR>
<TD align=middle width="15%" bgColor=skyblue>Skyblue<BR>87CEEB </TD>
<TD align=middle width="15%" bgColor=slateblue>Slateblue<BR>6A5ACD </TD>
<TD align=middle width="15%" bgColor=slategray>Slategray<BR>708090 
<TR>
<TD align=middle width="15%" bgColor=snow>Snow<BR>FFFAFA </TD>
<TD align=middle width="15%" bgColor=springgreen>Springgreen<BR>00FF7F </TD>
<TD align=middle width="15%" bgColor=steelblue>Steelblue<BR>4682B4 
<TR>
<TD align=middle width="15%" bgColor=tan>Tan<BR>D2B48C </TD>
<TD align=middle width="15%" bgColor=teal>Teal<BR>008080 </TD>
<TD align=middle width="15%" bgColor=thistle>Thistle<BR>D8BFD8 
<TR>
<TD align=middle width="15%" bgColor=tomato>Tomato<BR>FF6347 </TD>
<TD align=middle width="15%" bgColor=turquoise>Turquoise<BR>40E0D0 </TD>
<TD align=middle width="15%" bgColor=violet>Violet<BR>EE82EE 
<TR>
<TD align=middle width="15%" bgColor=wheat>Wheat<BR>F5DEB3<BR></TD>
<TD align=middle width="15%" bgColor=white>White<BR>FFFFFF </TD>
<TD align=middle width="15%" bgColor=whitesmoke>Whitesmoke<BR>F5F5F5 </TD></TR></TBODY></TABLE></CENTER>this color model is about html<img src ="http://www.blogjava.net/hegen/aggbug/9741.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hegen/" target="_blank">hegen</a> 2005-08-10 20:37 <a href="http://www.blogjava.net/hegen/archive/2005/08/10/9741.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>　实例形式的变压器模式的定义</title><link>http://www.blogjava.net/hegen/archive/2005/08/10/9734.html</link><dc:creator>hegen</dc:creator><author>hegen</author><pubDate>Wed, 10 Aug 2005 10:40:00 GMT</pubDate><guid>http://www.blogjava.net/hegen/archive/2005/08/10/9734.html</guid><wfw:comment>http://www.blogjava.net/hegen/comments/9734.html</wfw:comment><comments>http://www.blogjava.net/hegen/archive/2005/08/10/9734.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hegen/comments/commentRss/9734.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hegen/services/trackbacks/9734.html</trackback:ping><description><![CDATA[<HR>
实例形式的变压器模式的类图定义如下。 <BR><BR>
<P align=center><IMG src="http://www.yesky.com/20011225/jt1225-1-objectadapter.gif"></P> <BR><FONT size=-1>图2. 实例变压器模式的类图定义</FONT> <BR><BR>在图1可以看出,模式所涉及的成员有： <BR>
<UL>
<LI><B>目标（Target）</B>。这就是我们所期待得到的接口。目标可以是实的或抽象的类。<BR><BR>
<LI><B>源（Adaptee）</B>。现有需要适配的接口。 <BR><BR>
<LI><B>变压器（Adapter）</B>。变压器类是本模式的核心。变压器把源接口转换成目标接口。 显然，这一角色必须是实类。 </LI></UL><BR>　　本模式的示范代码如下： <BR><BR><PRE class=CODE>package com.javapatterns.adapter;
public interface Target {
    /**
     * Class Adaptee contains operation sampleOperation1.
     */
    void sampleOperation1();
    /**
     * Class Adaptee doesn't contain operation sampleOperation2.
     */
    void sampleOperation2();
}
</PRE><FONT size=-1>代码清单4. Target的源代码。</FONT> <BR><BR><PRE class=CODE>package com.javapatterns.adapter;
public class Adapter implements Target {
public Adapter(Adaptee adaptee){
        super();
        this.adaptee = adaptee;
    }
    public void sampleOperation1(){
        adaptee.sampleOperation1();
    }
    public void sampleOperation2(){
        // Write your code here
    }
    private Adaptee adaptee;
}
</PRE><FONT size=-1>　　代码清单5. Adapter的源代码。</FONT> <BR><BR><PRE class=CODE>package com.javapatterns.adapter;
public class Adaptee {
    public void sampleOperation1(){}
}
</PRE><FONT size=-1>代码清单6. Adaptee的源代码。</FONT> <BR><BR>　　<B><FONT color=#ac000>实例形式的变压器模式的效果</FONT></B><BR><BR><B>　　第一、 </B>一个变压器可以把多种不同的源适配到同一个目标。换言之，同一个变压器可以把源类和它的子类都适配到目标接口。 <BR><BR><B>　　第二、 </B>与类形式的变压器模式相比，要想置换源类的方法就不容易。如果一定要置换掉源类的一个或多个方法，就只好先做一个源类的子类， 将源类的方法置换掉，然后再把源类的子类当作真正的源进行适配。 <BR><BR><B>　　第三、 </B>虽然要想置换源类的方法不容易，但是要想增加一些新的方法则方便得很。 而且新增加的方法同时适用于所有的源。 <BR>
<HR>
<BR><STRONG><FONT color=#ac0000>利用变压器模式指方为圆<BR><BR></FONT></STRONG>　　中国古代有赵高指鹿为马的故事。鹿与马有很多相似之处，没见过的人本就分辨不清，指一指可能没什么大不了的。 指方为圆是否太过？非也。本例就是要指方为圆，需要的只是变压器模式这个魔术手指（Magic Finger）。 <BR><BR>　　变压器模式在本例子的类图如下。 <BR><BR>
<P align=center><IMG src="http://www.yesky.com/20011225/jt1225-1-cube2ball.gif"></P> <BR><FONT size=-1>图6. 指方为圆的变压器模式类图</FONT> <BR><BR><PRE class=CODE>package com.javapatterns.adapter.cube2ball;
public class Cube
{
    public Cube(double width)
    {
        this.width = width;
    }
    public double calculateVolume()
    {
     return width * width * width;
    }
    public double calculateFaceArea()
    {
        return width * width;
    }
    public double getWidth()
    {
        return this.width;
    }
    public void setWidth(double width)
    {
        this.width = width;
    }
    private double width;
}
</PRE><FONT size=-1>代码清单8. Cube类的源代码。。</FONT> <BR><BR><PRE class=CODE>package com.javapatterns.adapter.cube2ball;
public interface BallIF
{
    double calculateArea();
    double calculateVolume();
    double getRadius();
    void setRadius(double radius);
}
</PRE><FONT size=-1>代码清单9. BallIF接口的源代码。</FONT> <BR><BR><PRE class=CODE>package com.javapatterns.adapter.cube2ball;
public class MagicFinger implements BallIF
{
    public MagicFinger(Cube adaptee)
    {
        super();
        this.adaptee = adaptee;
        radius = adaptee.getWidth();
    }
    public double calculateArea()
    {
        return PI * 4.0D * ( radius * radius );
    }
    public double calculateVolume()
    {
        return PI * 4.0D/3.0D * ( radius * radius * radius );
    }
    public double getRadius()
    {
     return radius;
    }
    public void setRadius(double radius)
    {
     this.radius = radius;
    }
    private double radius = 0;
    private static final double PI = 3.14D;
    private Cube adaptee;
}
</PRE><FONT size=-1>代码清单10. MagicFinger类的源代码。</FONT> <BR><BR>　　如果读者还记得中学的数学的话，应该可以看出，我们的指方为圆系统其实还是有道理的。它接受一个正方体， 返还此正方体的内切球，也就是能放进此正方体的最大的球。 <BR><BR>　　显然，本例子里，我们使用的是实例形式的变压器模式。这样做的好处是，如果一旦我们决定不仅要支持正方体， 而且要支持四面体等多面体，我们可以使用同一个MagicFinger类，而不必针对每一个多面体都建立一个MagicFinger类。 这样也比较符合“魔术手指”这个名字。 <BR><img src ="http://www.blogjava.net/hegen/aggbug/9734.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hegen/" target="_blank">hegen</a> 2005-08-10 18:40 <a href="http://www.blogjava.net/hegen/archive/2005/08/10/9734.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>　　给定一个目录，要求把其中的文件和子目录全部打印出来</title><link>http://www.blogjava.net/hegen/archive/2005/08/02/9047.html</link><dc:creator>hegen</dc:creator><author>hegen</author><pubDate>Tue, 02 Aug 2005 09:29:00 GMT</pubDate><guid>http://www.blogjava.net/hegen/archive/2005/08/02/9047.html</guid><wfw:comment>http://www.blogjava.net/hegen/comments/9047.html</wfw:comment><comments>http://www.blogjava.net/hegen/archive/2005/08/02/9047.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hegen/comments/commentRss/9047.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hegen/services/trackbacks/9047.html</trackback:ping><description><![CDATA[要用到java.io.File中的一些方法<BR>比如<STRONG>isFile</STRONG> <PRE> public boolean isFile()
</PRE>
<DL>
<DD>测试当前 <CODE>File</CODE> 对象表示的文件是否是一个“普通”文件。 
<P>如果一个文件不是一个路径且满足其它系统的标准，则它是一个“普通”文件。由 Java 的一个应用程序创建的任何非路径文件肯定是一个“普通”文件。 
<P></P>
<DL>
<DT><B>返回值：</B> 
<DD>如果当前对象指定的文件存在且是一个“普通”文件则为 <CODE>true</CODE>；否则为 <CODE>false</CODE>。 
<DT><B>抛出：</B> <A href="http://www.leftworld.net/online/j2sedoc/javaref/jdkref/java.lang.securityexception_dsc.htm#_top_">SecurityException</A> 
<DD>如果有一个安全管理器，则用当前 <CODE>File</CODE> 的路径名调用 <CODE>checkRead</CODE> 方法，查看是否允许此应用程序读该文件。 
<DT><B>参见：</B> 
<DD><A href="http://www.leftworld.net/online/j2sedoc/javaref/jdkref/java.io.file_dsc.htm#getPath()">getPath</A>, <A href="http://www.leftworld.net/online/j2sedoc/javaref/jdkref/java.lang.securitymanager_dsc.htm#checkRead(java.lang.String)">checkRead</A> <BR><BR><BR><STRONG>File</STRONG> <PRE><STRONG> public File(</STRONG><A href="http://www.leftworld.net/online/j2sedoc/javaref/jdkref/java.io.file_dsc.htm#_top_"><STRONG>File</STRONG></A><STRONG> dir,
                  </STRONG><A href="http://www.leftworld.net/online/j2sedoc/javaref/jdkref/java.lang.string_dsc.htm#_top_"><STRONG>String</STRONG></A><STRONG> name)
</STRONG></PRE>
<DL>
<DD><STRONG>创建一个 <CODE>File</CODE> 实例，表示指定路径指定名称的文件。 </STRONG>
<P><STRONG>如果路径参数为 <CODE>null</CODE>, 则结果 <CODE>File</CODE> 实例表示在当前路径(与系统有关)下的一个文件，它的路径名是 <CODE>name</CODE> 参数。否则， <CODE>File</CODE> 实例表示一个文件，它的路径名是路径参数(dir)给定的路径名，后跟分隔符和 <CODE>name</CODE> 参数。 </STRONG>
<P></P>
<DD>
<DL>
<DT><STRONG>参数： </STRONG>
<DD><STRONG>dir - 路径。 </STRONG>
<DD><STRONG>name - 文件路径名。 </STRONG>
<DT><STRONG>参见： </STRONG>
<DD>
<DIV align=left><A href="http://www.leftworld.net/online/j2sedoc/javaref/jdkref/java.io.file_dsc.htm#getPath()"><STRONG>getPath</STRONG></A><STRONG>, </STRONG><A href="http://www.leftworld.net/online/j2sedoc/javaref/jdkref/java.io.file_dsc.htm#separator"><STRONG>separator</STRONG></A><BR><BR>下面是这个程序的代码：<BR>import java.io.*;<BR>import java.lang.*;<BR>public class Example20_4<BR>{ <BR>&nbsp;public static void Traverse(File dir){<BR>&nbsp;&nbsp;System.out.println(dir.toString());<BR>&nbsp;&nbsp;&nbsp;&nbsp; String fileName[]=dir.list();<BR>&nbsp;&nbsp;for(int i=0;i&lt;fileName.length;i++){<BR>&nbsp;&nbsp;&nbsp;System.out.println(fileName[i]);<BR>&nbsp;&nbsp;&nbsp;File dir1=new File(dir,fileName[i]);<BR>&nbsp;&nbsp;&nbsp;//String str=dir1.getPath();<BR>&nbsp;&nbsp;&nbsp;//File dir2=new File(str);<BR>&nbsp;&nbsp;&nbsp;if(dir1.isFile())<BR>&nbsp;&nbsp;&nbsp;&nbsp;continue;<BR>&nbsp;&nbsp;&nbsp;Traverse(dir1);<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;System.out.println();<BR>&nbsp;}<BR>&nbsp;public static void main(String [] args){<BR>&nbsp;&nbsp;File dir=new File(args[0]);<BR>&nbsp;&nbsp;Traverse(dir);<BR>&nbsp;}<BR>} <BR><BR><BR><BR></DIV></DD></DL></DD></DL></DD></DL></DD></DL><img src ="http://www.blogjava.net/hegen/aggbug/9047.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hegen/" target="_blank">hegen</a> 2005-08-02 17:29 <a href="http://www.blogjava.net/hegen/archive/2005/08/02/9047.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>