請看看下面兩道Java題,選擇哪個(gè)答案,并請說明原因!
請看看下面兩道Java題,選擇哪個(gè)答案,并請說明原因!
1.指出正確的表達(dá)式().
A. byte = 128;
B. Boolean = null;
C. long l = 0xfffL;
D. double = 0.9239d;
2.指出下列程序運(yùn)行的結(jié)果
public class Example{
String str=new String("good");
char[]ch={'a','b','c'};
public static void main(String args[]){
Example ex=new Example();
ex.change(ex.str,ex.ch);
System.out.print(ex.str+" and ");
System.out.print(ex.ch);
}
public void change(String str,char ch[]){
str="test ok";
ch[0]='g';
}
}
A.good and abc
B.good and gbc
C.test ok and abc
D.test ok and gbc
1.指出正確的表達(dá)式().
A. byte = 128;
B. Boolean = null;
C. long l = 0xfffL;
D. double = 0.9239d;
2.指出下列程序運(yùn)行的結(jié)果
public class Example{
String str=new String("good");
char[]ch={'a','b','c'};
public static void main(String args[]){
Example ex=new Example();
ex.change(ex.str,ex.ch);
System.out.print(ex.str+" and ");
System.out.print(ex.ch);
}
public void change(String str,char ch[]){
str="test ok";
ch[0]='g';
}
}
A.good and abc
B.good and gbc
C.test ok and abc
D.test ok and gbc
其他人氣:403 ℃時(shí)間:2020-10-02 02:17:29
優(yōu)質(zhì)解答
1.C答案A 超出了范圍 bye的取值范圍是-128-127 答案B boolean行只有兩種取值true和false沒有null 答案D 沒有變量名2.B 因?yàn)樽址鳛閰?shù)傳遞的時(shí)候,其實(shí)傳遞的是一個(gè)字符串的副本,所以對字符串的修...
我來回答
類似推薦
- 函數(shù)f(x)=sinx-cosx^2的最小值是?
- 英語翻譯
- I took my grandpa to the hospital this morning,_____ I missed the first class.
- So crazy
- 方差是各個(gè)數(shù)據(jù)與平均數(shù)之差的平方的平均數(shù)
- 函數(shù)y=f(x)與它反函數(shù)y=f^-1(x)怎么讀?
- These are photos of my families.Look at them 改錯(cuò)
- 所有的奇數(shù)都是質(zhì)數(shù),所有的偶數(shù)都是合數(shù),{這句話對還是錯(cuò)?} 說出理由
- 如圖,OA、OB表示兩條相交的公路,點(diǎn)M、N是兩個(gè)工廠,現(xiàn)在要在∠AOB內(nèi)建立一個(gè)貨物中轉(zhuǎn)站P,使中轉(zhuǎn)站到公路OA、OB的距離相等,并且到工廠M、N的距離也相等,用尺規(guī)作出貨物中轉(zhuǎn)站P的位置.
- 空氣在零下幾度會(huì)變成液體
- 不定副詞和不定介詞是什么意思?
- 提燈女神中寫了南丁格爾幾件事,請用簡要的語言概括
猜你喜歡
- 1平面與平面重合,是否屬于平行一類?那重合的兩直線,也屬于平行一類的嗎?
- 2非洲每年因饑餓死亡的人數(shù)及現(xiàn)在饑餓人口數(shù)量拜托各位了 3Q
- 3decide to do sth.還=什么
- 4(7/8)o you think of london?B:5.____london is one of the liveliest cities
- 5啤酒可以托運(yùn)嗎
- 6邊長為2√6的等邊三角形的中心到一邊的距離為?
- 7please give your hand to help me
- 8已知2的X次方等于3的Y次方等于6的Z次方不等等于1,證明X分之一加Y分之一等于Z分之一.
- 9幫我做做?
- 10機(jī)械分析天平TG628A的使用說明書
- 11in winter ,we wear warm coats to protect our bodies_.
- 12( )was most importance to her ,she told me,was her family it this what as