锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
]]>
2銆?span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽 Java 涓墍鏈夌殑瀵硅薄閮芥槸閫氳繃 new 鏉ュ姩鎬佷駭鐢?/span>
3銆?span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽 鎵鏈夌殑瀹瑰櫒 (collection) 鍜?/span> Object array( 瀵硅薄鏁扮粍 e.g String []str=new String[10]) 鍐呴兘鍖呭惈閮芥槸瀵硅薄鐨?/span> reference
4銆?span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽
鍦?/span>
java
涓紝
java
緙栬瘧鍣ㄦ湁璐d換浜х敓鈥滃皢
stack
鎸囬拡鍓嶅悗縐誨姩鈥滅殑紼嬪簭浠g爜錛屾墍浠?/span>
瀹冨繀欏昏兘澶熷畬鍏ㄦ帉鎻″畠鎵緙栬瘧鐨勭殑紼嬪簭涓滃瓨鍦?/span>
stack
閲屽ご鐨勬墍鏈夋暟鎹殑瀹為檯澶у皬鍜屽瓨媧繪椂闂粹滐紝
濡傛涓鏉ヤ究浼氶檺鍒剁▼搴忕殑寮規с?/span>
鐢變簬榪欎釜闄愬埗錛屽敖綆℃垜浠彲浠ュ皢瀵硅薄鐨?/span>
reference
瀛樺偍涓?/span>
stack
鍐咃紝浣嗗嵈涓嶈兘灝嗕竴鑸殑
java
瀵硅薄鏀懼湪
stack
涓?/span>
鐗逛緥錛氾紙
primitive
types
錛?/span>
鍩烘湰鍨嬪埆浼氱粡甯歌浣跨敤錛屽鏋滀嬌鐢?/span>
new
鏉ヤ駭鐢熸綾繪瀬灝忥紝鏋佺畝鍗曠殑鍙橀噺錛屼細鍥犫?/span>
new
灝嗗璞$疆浜?/span>
heap
涔嬩笂鈥?/span>
鑰屾晥鐜囦笉濂姐傚洜姝ゅ浜庢綾誨彉閲?/span>
java
閲囧彇
c/c++
鐨勬柟寮忥紝涔熷氨鏄笉鐢?/span>
new
鍒嗛厤鍣ㄧ┖闂達紝鑰屾槸浜х敓涓縐嶆墍璋撶殑
鈥漚utomatic
鈥滃彉閲忥紝瀛樹簬
static
涓?/span>
5銆?span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽 褰撲綘浜х敓鏌愪釜瀛樺偍瀵硅薄鐨勬暟緇勶紝鐪熸浜х敓鐨勬槸涓瓨鍌?/span> reference 鐨勬暟緇勩傛鏁扮粍寤虹珛涔嬪悗錛屽叾涓殑姣忎竴涓?/span> reference 閮戒細琚嚜鍔ㄨ涓烘煇涓壒孌婄殑鍊?/span> null,
6銆?span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽 { String s=new String(鈥渄dd鈥?;} s 榪欎釜 reference 浼氬湪鐢熷瓨絀洪棿涔嬪娑堝け鏃犺釜錛屼絾鏄紝 s 鍏堝墠鎵鎸囩殑閭d釜 String 瀵硅薄浠嶇劧浼氱戶緇崰鐢ㄥ唴瀛?/span>
7銆?span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽 Class 鍐呯殑鍩烘湰鍨嬪埆鍙橀噺閮芥湁鍒濆鹼紝浣嗘槸鍦ㄥ嚱鏁板唴鐨?/span> local variable 鏄病鏈夊垵鍊肩殑
8銆?span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽 Java 涓紝鎵鏈変紶閫掔殑瀵硅薄鐨勫満鍚堬紝浼犻掔殑閮芥槸瀵硅薄鐨?/span> reference.
9銆?span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽 Return 錛?/span> 璇存槑榪欎釜鍑芥暟榪愯緇撴潫錛岃繑鍥炲埌鍏惰皟鐢ㄥ嚱鏁般?/span> Return 2 錛氳繑鍥炰竴涓暟 2 緇欒皟鐢ㄨ咃紝鍚屾椂緇撴潫鏈嚱鏁扮殑榪愯銆?/span>
10銆?span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽聽聽聽聽聽聽聽聽聽聽聽聽 Class 鍐呯殑 non-static data(state) 鍜?/span> method , 閮芥槸鍜岀壒瀹氱殑瀵硅薄緇戝畾鐨勶紝涓鑸儏鍐典笅錛屼綘鐨勪駭鐢熸煇涓璞★紝鍐嶉氳繃璇ュ璞″彇鐢ㄥ叾鏁版嵁鍜屽嚱鏁般傛墍浠?/span> non-static 鏁版嵁 / 鍑芥暟蹇呴』鐭ラ亾浠栦滑闅跺睘浜庡摢涓涓璞★紝鎵嶆湁鍔炴硶榪愯 .static 鍑芥暟鍐呬笉鑳戒嬌鐢?/span> non-static 鏁版嵁鍜屽嚱鏁?/span>
11銆?span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽聽聽聽聽聽聽聽聽聽聽聽聽
(object1= = object2 )
涓や釜瀵硅薄鐨?/span>
reference
鐨?/span>
= =
姣旇緝寰楁槸涓や釜瀵硅薄鐨勫唴瀛樼殑鍦板潃銆傛墍浠ユ垜浠笉鑳戒嬌鐢?/span>
= =
鏉ユ祴璇曚袱涓璞$殑鍐呭鏄惁鐩哥瓑銆傚鏋滄兂嫻嬭瘯瀵硅薄鐨勫唴瀹規槸鍚︾浉絳夛紝搴旇浣跨敤
equal(),
浠諱綍涓涓璞¢兘鎷ユ湁榪欎釜鍑芥暟銆備笉榪囦綘鑷繁鐨?/span>
class
闇瑕?/span>
override
榪欎釜鍑芥暟錛屽惁鍒欓粯璁ょ殑
equal()
鍑芥暟鏄繕鏄瘮杈冪殑涓や釜瀵硅薄鐨勫唴瀛樺湴鍧銆?/span>
Java
鏍囧噯紼嬪簭搴撲腑鐨勫ぇ澶氭暟
class
閮?/span>
override
浜?/span>
equal(),
鎵浠ヤ粬浠兘浼氭瘮杈冨璞$殑鍐呭鏄惁鐩哥瓑銆?/span>
12銆?span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽聽聽聽聽聽聽聽聽聽聽聽聽 浣嶈繍綆楃閮芥槸浣滅敤浜庡熀鏈鏁扮被鍨嬨傝榪愮畻絎︿富瑕佹槸閽堝紜歡緙栫▼浣跨敤錛堟垜浠敤寰椾笉澶氾紝錛?/span>
寰呯畫