锘??xml version="1.0" encoding="utf-8" standalone="yes"?>在线国产一区二区三区,国产精品免费99久久久,久久超碰亚洲http://www.aygfsteel.com/hegen/zh-cnTue, 17 Jun 2025 18:30:59 GMTTue, 17 Jun 2025 18:30:59 GMT60 java.lang.NullPointerExceptionhttp://www.aygfsteel.com/hegen/archive/2005/08/25/11032.htmlhegenhegenThu, 25 Aug 2005 05:43:00 GMThttp://www.aygfsteel.com/hegen/archive/2005/08/25/11032.htmlhttp://www.aygfsteel.com/hegen/comments/11032.htmlhttp://www.aygfsteel.com/hegen/archive/2005/08/25/11032.html#Feedback0http://www.aygfsteel.com/hegen/comments/commentRss/11032.htmlhttp://www.aygfsteel.com/hegen/services/trackbacks/11032.html
public class NullPointerException
extends RuntimeException

褰撲竴涓簲鐢ㄥ湪闇瑕佷竴涓璞$殑鍦版柟璇曞浘浣跨敤 null 鏃舵姏鍑恒傚畠浠寘鎷細

  • 璋冪敤涓涓?null 瀵硅薄鐨勫疄渚嬫柟娉曘?
  • 璁塊棶鎴栦慨鏀逛竴涓?null 瀵硅薄鐨勫煙銆?
  • 灝?null 浣滀負涓涓暟緇勶紝浣跨敤瀹冪殑闀垮害銆?
  • 灝?null 浣滀負涓涓暟緇勶紝璁塊棶鎴栦慨鏀瑰畠鐨勬彃鍙c?
  • 灝?null 浣滀負涓涓?Throwable 鍊兼姏鍑恒?

搴旂敤搴旇鎶涘嚭璇ョ被鐨勫疄渚嬶紝鎸囩ず鍏跺畠瀵?null 瀵硅薄鐨勯潪娉曚嬌鐢ㄣ?BR>






鏋勯犲瓙绱㈠紩

NullPointerException()
鏋勯犱竴涓病鏈夎緇嗘秷鎭殑 NullPointerException銆?
NullPointerException(String)
鏋勯犱竴涓叿鏈夋寚瀹氳緇嗘秷鎭殑 NullPointerException




鏋勯犲瓙

NullPointerException
 public NullPointerException()
鏋勯犱竴涓病鏈夎緇嗘秷鎭殑 NullPointerException銆?

NullPointerException
 public NullPointerException(String s)
鏋勯犱竴涓叿鏈夋寚瀹氳緇嗘秷鎭殑 NullPointerException銆?

鍙傛暟錛?/B>
s - 璇︾粏娑堟伅銆?



hegen 2005-08-25 13:43 鍙戣〃璇勮
]]>
thinking http://www.aygfsteel.com/hegen/archive/2005/08/25/10967.htmlhegenhegenWed, 24 Aug 2005 18:14:00 GMThttp://www.aygfsteel.com/hegen/archive/2005/08/25/10967.htmlhttp://www.aygfsteel.com/hegen/comments/10967.htmlhttp://www.aygfsteel.com/hegen/archive/2005/08/25/10967.html#Feedback0http://www.aygfsteel.com/hegen/comments/commentRss/10967.htmlhttp://www.aygfsteel.com/hegen/services/trackbacks/10967.html

hegen 2005-08-25 02:14 鍙戣〃璇勮
]]>
紼蟲墡紼蟲墦鎵嶆槸鐪?/title><link>http://www.aygfsteel.com/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.aygfsteel.com/hegen/archive/2005/08/18/10385.html</guid><wfw:comment>http://www.aygfsteel.com/hegen/comments/10385.html</wfw:comment><comments>http://www.aygfsteel.com/hegen/archive/2005/08/18/10385.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/hegen/comments/commentRss/10385.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/hegen/services/trackbacks/10385.html</trackback:ping><description><![CDATA[銆鐪嬪畬浜?STRONG>紼嬪姛鐨勬晠浜嬪悗錛屾劅鍒板彧鏈夌ǔ鎵庣ǔ鎵撴墠鏄湡錛屽彧鏈夊姫鍔涙墠鑳芥垚鍔燂紝</STRONG>鎴戞槸絎ㄩ笩錛岀楦熷彧鏈変互鍕よˉ鎷欙紝絎ㄩ笩鏄鍏堥鐨勶紟<img src ="http://www.aygfsteel.com/hegen/aggbug/10385.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/hegen/" target="_blank">hegen</a> 2005-08-18 00:44 <a href="http://www.aygfsteel.com/hegen/archive/2005/08/18/10385.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Garbage Collectionhttp://www.aygfsteel.com/hegen/archive/2005/08/11/9805.htmlhegenhegenThu, 11 Aug 2005 05:46:00 GMThttp://www.aygfsteel.com/hegen/archive/2005/08/11/9805.htmlhttp://www.aygfsteel.com/hegen/comments/9805.htmlhttp://www.aygfsteel.com/hegen/archive/2005/08/11/9805.html#Feedback0http://www.aygfsteel.com/hegen/comments/commentRss/9805.htmlhttp://www.aygfsteel.com/hegen/services/trackbacks/9805.htmlState the behavior that is guaranteed by the garbage collection system and write code that explicitly makes objects eligible for collection.
1.    Garbage collection is a mechanism for reclaiming memory from objects that are no longer in use, and making the memory available for new objects.
2.    An object being no longer in use means that it can鈥檛 be referenced by any 鈥榓ctive鈥?part of the program.
3.    Garbage collection runs in a low priority thread. It may kick in when memory is too low. No guarantee.
4.    It鈥檚 not possible to force garbage collection. Invoking System.gc may start garbage collection process.
5.    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.
6.    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.
7.    Circular references do not prevent objects from being garbage collected.
8.    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鈥檚 attached to a listener. (Typical in case of AWT components) Remember to remove the listener first.
9.    All objects have a finalize method. It is inherited from the Object class.
10.    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鈥檛 rely on it. This is the signature of the finalize method.
protected void finalize() throws Throwable { }
In the descendents this method can be protected or public. Descendents can restrict the exception list that can be thrown by this method.
11.    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)
12.    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 鈥榬esurrection鈥?can be done only once, since finalize is called only one for an object.
13.    finalize can be called explicitly, but it does not garbage collect the object.
14.    finalize can be overloaded, but only the method with original finalize signature will be called by gc.
15.    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鈥檛 enforce this check.
16.    System.runFinalization can be used to run the finalizers (which have not been executed before) for the objects eligible for garbage collection.
17.    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.  
18.    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.
19.    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.


In the exam point of view :
飩鳳燳ou must be able to identify when an object is available for gc - you have either set it to null or you
have "redirected" the variable that was originally referring to it, so that it now refers to a different
object.
飩鳳爄f you have a reference to an object say, A and then you pass A as an argument to some constructor -
new obj(A); - then even if you null your reference - A=null; - you can't say that A is available for
gc. So just follow the references and when they drop to zero you know its eligible/available for gc,
not that it will happen.


I can not full understand these statements which are above.



eg,
1. obj = new Jo();
2. obj.doSomething();
3. obj = new Jo(); //Same as obj=null;
4. obj.doSomething();

Object a = new Object();
Object a=null; //Now the object created in 1st line is available for gc
Object a=new Object();
a = new Object(); //same.
// Now original object created in line 1 is available for gc and a new
object is now out there referenced by "a".

Aclass a = new Aclass(); // Object 1
Aclass b= new Aclass(); // Object 2
Aclass c = new Aclass(); // Object 3
a=b; // now we have no valid object reference to object "a" and it will be
// garbage collected sometime after this statement. But when?......
a=c;
c=null; // no garbage collection will be eligible since
// "a" still refers to Object 3
a=null; // now object "c" is eligible for gc since it always had a valid reference.
// Should "b" go out of scope; then we would possibly have eligibility for gc.
// there might still be other references to object "b" preventing the collection.


hegen 2005-08-11 13:46 鍙戣〃璇勮
]]>
Some Text Colorhttp://www.aygfsteel.com/hegen/archive/2005/08/10/9742.htmlhegenhegenWed, 10 Aug 2005 12:48:00 GMThttp://www.aygfsteel.com/hegen/archive/2005/08/10/9742.htmlhttp://www.aygfsteel.com/hegen/comments/9742.htmlhttp://www.aygfsteel.com/hegen/archive/2005/08/10/9742.html#Feedback0http://www.aygfsteel.com/hegen/comments/commentRss/9742.htmlhttp://www.aygfsteel.com/hegen/services/trackbacks/9742.htmlText Color CodesIn order to change text colors, you will need two things:

1. A command to change the text.
2. A color (hex) code.


Changing Full-Page Text ColorsYou have the ability to change full-page text colors over four levels:

<TEXT="######"> -- This denotes the full-page text color.

<LINK="######"> -- This denotes the color of the links on your page.

<ALINK="######"> -- This denotes the color the link will flash when clicked upon.

<VLINK="######"> -- This denotes the colors of the links after they have been visited.

These commands come right after the <TITLE> commands. Again, in that position they affect everything on the page. Also... place them all together inside the same command along with any background commands. Something like this:

< BODY BGCOLOR="######" TEXT="######" LINK="######" VLINK="######">

Please note: 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:

<VLINK="#FFFFFF">

闂錛?BR>銆銆涓婇潰鐨勯偅鍑犱釜涓滆タ榪樻病鏈夋悶鎳傦紟涓嶇煡閬撲粈涔堢敤錛?BR>


Changing Specific Word ColorBut I only want to change one word's color!

You'll use a color (hex) code to do the trick. Follow this formula:

<FONT COLOR="######">text text text text text</FONT>

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.




hegen 2005-08-10 20:48 鍙戣〃璇勮
]]>
A Basic Color Codehttp://www.aygfsteel.com/hegen/archive/2005/08/10/9741.htmlhegenhegenWed, 10 Aug 2005 12:37:00 GMThttp://www.aygfsteel.com/hegen/archive/2005/08/10/9741.htmlhttp://www.aygfsteel.com/hegen/comments/9741.htmlhttp://www.aygfsteel.com/hegen/archive/2005/08/10/9741.html#Feedback0http://www.aygfsteel.com/hegen/comments/commentRss/9741.htmlhttp://www.aygfsteel.com/hegen/services/trackbacks/9741.htmlPlease note:
"Aqua" and "Cyan" produce the same color: 00FFFF
"Fuchsia" and "Magenta" produce the same color: FF00FF

Aliceblue
F0F8FF
Antiquewhite
FAEBD7
Aqua
00FFFF
Aquamarine
7FFFD4
Azure
F0FFFF
Beige
F5F5DC
Bisque
FFE4C4
Black
000000
Blanchedalmond
FFEBCD
Blue
0000FF
Blueviolet
8A2BE2
Brown
A52A2A
Burlywood
DEB887
Cadetblue
5F9EA0
Chartreuse
7FFF00
Chocolate
D2691E
Coral
FF7F50
Cornflowerblue
6495ED
Cornsilk
FFF8DC
Crimson
DC143C
Cyan
00FFFF
Darkblue
00008B
Darkcyan
008B8B
Darkgoldenrod
B8860B
Darkgray
A9A9A9
Darkgreen
006400
Darkkhaki
BDB76B
Darkmagenta
8B008B
Darkolivegreen
556B2F
Darkorange
FF8C00
Darkorchid
9932CC
Darkred
8B0000
Darksalmon
E9967A
Darkseagreen
8FBC8F
Darkslateblue
483D8B
Darkslategray
2F4F4F
Darkturquoise
00CED1
Darkviolet
9400D3
deeppink
FF1493
Deepskyblue
00BFFF
Dimgray
696969
Dodgerblue
1E90FF
Firebrick
B22222
Floralwhite
FFFAF0
Forestgreen
228B22
Fuchsia
FF00FF
Gainsboro
DCDCDC
Ghostwhite
F8F8FF
Gold
FFD700
Goldenrod
DAA520
Gray
808080
Green
008000
Greenyellow
ADFF2F
Honeydew
F0FFF0
Hotpink
FF69B4
Indianred
CD5C5C
Indigo
4B0082
Ivory
FFFFF0
Khaki
F0E68C
Lavender
E6E6FA
Lavenderblush
FFF0F5
Lawngreen
7CFC00
Lemonchiffon
FFFACD
Lightblue
ADD8E6
Lightcoral
F08080
Lightcyan
E0FFFF
Lightgoldenrodyellow
FAFAD2
Lightgreen
90EE90
Lightgrey
D3D3D3
Lightpink
FFB6C1
Lightsalmon
FFA07A
Lightseagreen
20B2AA
Lightskyblue
87CEFA
Lightslategray
778899
Lightsteelblue
B0C4DE
Lightyellow
FFFFE0
Lime
00FF00
Limegreen
32CD32
Linen
FAF0E6
Magenta
FF00FF
Maroon
800000
Mediumauqamarine
66CDAA
Mediumblue
0000CD
Mediumorchid
BA55D3
Mediumpurple
9370D8
Mediumseagreen
3CB371
Mediumslateblue
7B68EE
Mediumspringgreen
00FA9A
Mediumturquoise
48D1CC
Mediumvioletred
C71585
Midnightblue
191970
Mintcream
F5FFFA
Mistyrose
FFE4E1
Moccasin
FFE4B5
Navajowhite
FFDEAD
Navy
000080
Oldlace
FDF5E6
Olive
808000
Olivedrab
688E23
Orange
FFA500
Orangered
FF4500
Orchid
DA70D6
Palegoldenrod
EEE8AA
Palegreen
98FB98
Paleturquoise
AFEEEE
Palevioletred
D87093
Papayawhip
FFEFD5
Peachpuff
FFDAB9
Peru
CD853F
Pink
FFC0CB
Plum
DDA0DD
Powderblue
B0E0E6
Purple
800080
Red
FF0000
Rosybrown
BC8F8F
Royalblue
4169E1
Saddlebrown
8B4513
Salmon
FA8072
Sandybrown
F4A460
Seagreen
2E8B57
Seashell
FFF5EE
Sienna
A0522D
Silver
C0C0C0
Skyblue
87CEEB
Slateblue
6A5ACD
Slategray
708090
Snow
FFFAFA
Springgreen
00FF7F
Steelblue
4682B4
Tan
D2B48C
Teal
008080
Thistle
D8BFD8
Tomato
FF6347
Turquoise
40E0D0
Violet
EE82EE
Wheat
F5DEB3
White
FFFFFF
Whitesmoke
F5F5F5
this color model is about html

hegen 2005-08-10 20:37 鍙戣〃璇勮
]]>
銆瀹炰緥褰㈠紡鐨勫彉鍘嬪櫒妯″紡鐨勫畾涔?/title><link>http://www.aygfsteel.com/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.aygfsteel.com/hegen/archive/2005/08/10/9734.html</guid><wfw:comment>http://www.aygfsteel.com/hegen/comments/9734.html</wfw:comment><comments>http://www.aygfsteel.com/hegen/archive/2005/08/10/9734.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/hegen/comments/commentRss/9734.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/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>鍥?. 瀹炰緥鍙樺帇鍣ㄦā寮忕殑綾誨浘瀹氫箟</FONT> <BR><BR>鍦ㄥ浘1鍙互鐪嬪嚭,妯″紡鎵娑夊強鐨勬垚鍛樻湁錛?<BR> <UL> <LI><B>鐩爣錛圱arget錛?/B>銆傝繖灝辨槸鎴戜滑鎵鏈熷緟寰楀埌鐨勬帴鍙c傜洰鏍囧彲浠ユ槸瀹炵殑鎴栨娊璞$殑綾匯?BR><BR> <LI><B>婧愶紙Adaptee錛?/B>銆傜幇鏈夐渶瑕侀傞厤鐨勬帴鍙c?<BR><BR> <LI><B>鍙樺帇鍣紙Adapter錛?/B>銆傚彉鍘嬪櫒綾繪槸鏈ā寮忕殑鏍稿績銆傚彉鍘嬪櫒鎶婃簮鎺ュ彛杞崲鎴愮洰鏍囨帴鍙c?鏄劇劧錛岃繖涓瑙掕壊蹇呴』鏄疄綾匯?</LI></UL><BR>銆銆鏈ā寮忕殑紺鴻寖浠g爜濡備笅錛?<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>浠g爜娓呭崟4. Target鐨勬簮浠g爜銆?/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>銆銆浠g爜娓呭崟5. Adapter鐨勬簮浠g爜銆?/FONT> <BR><BR><PRE class=CODE>package com.javapatterns.adapter; public class Adaptee { public void sampleOperation1(){} } </PRE><FONT size=-1>浠g爜娓呭崟6. Adaptee鐨勬簮浠g爜銆?/FONT> <BR><BR>銆銆<B><FONT color=#ac000>瀹炰緥褰㈠紡鐨勫彉鍘嬪櫒妯″紡鐨勬晥鏋?/FONT></B><BR><BR><B>銆銆絎竴銆?</B>涓涓彉鍘嬪櫒鍙互鎶婂縐嶄笉鍚岀殑婧愰傞厤鍒板悓涓涓洰鏍囥傛崲璦涔嬶紝鍚屼竴涓彉鍘嬪櫒鍙互鎶婃簮綾誨拰瀹冪殑瀛愮被閮介傞厤鍒扮洰鏍囨帴鍙c?<BR><BR><B>銆銆絎簩銆?</B>涓庣被褰㈠紡鐨勫彉鍘嬪櫒妯″紡鐩告瘮錛岃鎯崇疆鎹㈡簮綾葷殑鏂規硶灝變笉瀹規槗銆傚鏋滀竴瀹氳緗崲鎺夋簮綾葷殑涓涓垨澶氫釜鏂規硶錛屽氨鍙ソ鍏堝仛涓涓簮綾葷殑瀛愮被錛?灝嗘簮綾葷殑鏂規硶緗崲鎺夛紝鐒跺悗鍐嶆妸婧愮被鐨勫瓙綾誨綋浣滅湡姝g殑婧愯繘琛岄傞厤銆?<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>鍥?. 鎸囨柟涓哄渾鐨勫彉鍘嬪櫒妯″紡綾誨浘</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>浠g爜娓呭崟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>浠g爜娓呭崟9. BallIF鎺ュ彛鐨勬簮浠g爜銆?/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>浠g爜娓呭崟10. MagicFinger綾葷殑婧愪唬鐮併?/FONT> <BR><BR>銆銆濡傛灉璇昏呰繕璁板緱涓鐨勬暟瀛︾殑璇濓紝搴旇鍙互鐪嬪嚭錛屾垜浠殑鎸囨柟涓哄渾緋葷粺鍏跺疄榪樻槸鏈夐亾鐞嗙殑銆傚畠鎺ュ彈涓涓鏂逛綋錛?榪旇繕姝ゆ鏂逛綋鐨勫唴鍒囩悆錛屼篃灝辨槸鑳芥斁榪涙姝f柟浣撶殑鏈澶х殑鐞冦?<BR><BR>銆銆鏄劇劧錛屾湰渚嬪瓙閲岋紝鎴戜滑浣跨敤鐨勬槸瀹炰緥褰㈠紡鐨勫彉鍘嬪櫒妯″紡銆傝繖鏍峰仛鐨勫ソ澶勬槸錛屽鏋滀竴鏃︽垜浠喅瀹氫笉浠呰鏀寔姝f柟浣擄紝 鑰屼笖瑕佹敮鎸佸洓闈綋絳夊闈綋錛屾垜浠彲浠ヤ嬌鐢ㄥ悓涓涓狹agicFinger綾伙紝鑰屼笉蹇呴拡瀵規瘡涓涓闈綋閮藉緩绔嬩竴涓狹agicFinger綾匯?榪欐牱涔熸瘮杈冪鍚堚滈瓟鏈墜鎸団濊繖涓悕瀛椼?<BR><img src ="http://www.aygfsteel.com/hegen/aggbug/9734.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/hegen/" target="_blank">hegen</a> 2005-08-10 18:40 <a href="http://www.aygfsteel.com/hegen/archive/2005/08/10/9734.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>銆銆緇欏畾涓涓洰褰曪紝瑕佹眰鎶婂叾涓殑鏂囦歡鍜屽瓙鐩綍鍏ㄩ儴鎵撳嵃鍑烘潵http://www.aygfsteel.com/hegen/archive/2005/08/02/9047.htmlhegenhegenTue, 02 Aug 2005 09:29:00 GMThttp://www.aygfsteel.com/hegen/archive/2005/08/02/9047.htmlhttp://www.aygfsteel.com/hegen/comments/9047.htmlhttp://www.aygfsteel.com/hegen/archive/2005/08/02/9047.html#Feedback0http://www.aygfsteel.com/hegen/comments/commentRss/9047.htmlhttp://www.aygfsteel.com/hegen/services/trackbacks/9047.html姣斿isFile
 public boolean isFile()
嫻嬭瘯褰撳墠 File 瀵硅薄琛ㄧず鐨勬枃浠舵槸鍚︽槸涓涓滄櫘閫氣濇枃浠躲?

濡傛灉涓涓枃浠朵笉鏄竴涓礬寰勪笖婊¤凍鍏跺畠緋葷粺鐨勬爣鍑嗭紝鍒欏畠鏄竴涓滄櫘閫氣濇枃浠躲傜敱 Java 鐨勪竴涓簲鐢ㄧ▼搴忓垱寤虹殑浠諱綍闈炶礬寰勬枃浠惰偗瀹氭槸涓涓滄櫘閫氣濇枃浠躲?

榪斿洖鍊鹼細
濡傛灉褰撳墠瀵硅薄鎸囧畾鐨勬枃浠跺瓨鍦ㄤ笖鏄竴涓滄櫘閫氣濇枃浠跺垯涓?true錛涘惁鍒欎負 false銆?
鎶涘嚭錛?/B> SecurityException
濡傛灉鏈変竴涓畨鍏ㄧ鐞嗗櫒錛屽垯鐢ㄥ綋鍓?File 鐨勮礬寰勫悕璋冪敤 checkRead 鏂規硶錛屾煡鐪嬫槸鍚﹀厑璁告搴旂敤紼嬪簭璇昏鏂囦歡銆?
鍙傝錛?/B>
getPath, checkRead


File
 public File(File dir,
                  String name)
鍒涘緩涓涓?File 瀹炰緥錛岃〃紺烘寚瀹氳礬寰勬寚瀹氬悕縐扮殑鏂囦歡銆?

濡傛灉璺緞鍙傛暟涓?null, 鍒欑粨鏋?File 瀹炰緥琛ㄧず鍦ㄥ綋鍓嶈礬寰?涓庣郴緇熸湁鍏?涓嬬殑涓涓枃浠訛紝瀹冪殑璺緞鍚嶆槸 name 鍙傛暟銆傚惁鍒欙紝 File 瀹炰緥琛ㄧず涓涓枃浠訛紝瀹冪殑璺緞鍚嶆槸璺緞鍙傛暟(dir)緇欏畾鐨勮礬寰勫悕錛屽悗璺熷垎闅旂鍜?name 鍙傛暟銆?

鍙傛暟錛?
dir - 璺緞銆?
name - 鏂囦歡璺緞鍚嶃?
鍙傝錛?
getPath, separator

涓嬮潰鏄繖涓▼搴忕殑浠g爜錛?BR>import java.io.*;
import java.lang.*;
public class Example20_4
{
 public static void Traverse(File dir){
  System.out.println(dir.toString());
     String fileName[]=dir.list();
  for(int i=0;i<fileName.length;i++){
   System.out.println(fileName[i]);
   File dir1=new File(dir,fileName[i]);
   //String str=dir1.getPath();
   //File dir2=new File(str);
   if(dir1.isFile())
    continue;
   Traverse(dir1);
  }
  System.out.println();
 }
 public static void main(String [] args){
  File dir=new File(args[0]);
  Traverse(dir);
 }
}





hegen 2005-08-02 17:29 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 抚宁县| 永登县| 台湾省| 康平县| 启东市| 苗栗县| 泊头市| 莒南县| 鄂温| 伊吾县| 陈巴尔虎旗| 布拖县| 延长县| 沁源县| 鄂尔多斯市| 东明县| 林口县| 伽师县| 秦安县| 德钦县| 遵义县| 大丰市| 航空| 合阳县| 菏泽市| 甘谷县| 五指山市| 平乐县| 汪清县| 丹巴县| 包头市| 蒲江县| 保定市| 沾化县| 尼木县| 从江县| 三原县| 大埔区| 怀安县| 宜兰市| 拉孜县|