指出下列程式執行的結果()
public
class
example
;public
static
void
main
(string args)
public
void
change
(string str,
char ch)
}
a. good and abc
b. good and gbc
c. test ok and abc
d. test ok and gbc
b題目中的形參str只是原引用ex.str的乙個引用副本,傳的是乙個副本位址值,這個值與ex.str位址值是不一樣的,但是它們同時指向了堆中的物件new string("good")
,當你在函式中改變形參也就是位址的副本值也就是這句str=「test ok"只是將副本位址指向常量"test ok」,並沒有改變原ex.str的指向方向,它還是指向物件new string(「good」)的
char陣列與string一樣傳的也是位址的副本,但是關鍵是形參ch它沒有新的指向 ch[0]只是ch在指向原物件時改變了物件的內部結構, 所以在ex.ch指向與它是同乙個物件的情況下當然也會隨之變化
黑馬程式設計師 程式的執行結果
asp.net unity開發 net培訓 期待與您交流!int i 10 console.writeline i console.writeline i console.writeline i 20 console.writeline i 20 答案 10 12 20 true 解答 i 表示式的...
Java 程式中執行update返回結果
hibernate中execute executequery和executeupdate之間的區別 statement 介面提供了三種執行 sql 語句的方法 executequery executeupdate 和 execute。使用哪乙個方法由 sql 語句所產生的內容決定。方法execute...
在dos下執行程式並得到執行結果
imports system.diagnostics dim p as new process p.startinfo.filename cmd.exe p.startinfo.useshellexecute false p.startinfo.redirectstandardinput true ...