中文一二三区_九九在线中文字幕无码_国产一二区av_38激情网_欧美一区=区三区_亚洲高清免费观看在线视频

首頁 > 考試輔導 > 計算機考試 > JAVA認證 > JAVA認證試題集錦 > SUN認證Java2程序員考試(SCJP) 試題解析(2)

SUN認證Java2程序員考試(SCJP) 試題解析(2)

which of the following lines of code will compile without error?  
a.  
int i=0;  
if (i) {  
system.out.println(“hi”);  
}  
b.  
boolean b=true;  
boolean b2=true;  
if(b==b2) {  
system.out.println(“so true”);  
}  
c.  
int i=1;  
int j=2;  
if(i==1|| j==2)  
system.out.println(“ok”);  
d.  
int i=1;  
int j=2;  
if (i==1 &| j==2)  
system.out.println(“ok”);  
解答:b, c  
點評:選項a錯,因為if語句后需要一個boolean類型的表達式。邏輯操作有^、&、| 和 &&、||,但是“&|”是非法的,所以選項d不正確。  

例題5:  
which two demonstrate a "has a" relationship? (choose two)  
a. public interface person { }  
public class employee extends person{ }  
b. public interface shape { }  
public interface rectandle extends shape { }  
c. public interface colorable { }  
public class shape implements colorable  
{ }  
d. public class species{ }  
public class animal{private species species;}  
e. interface component{ }  
class container implements component{  
private component[] children;  
}  
解答:d, e  
  點評: 在java中代碼重用有兩種可能的方式,即組合(“has a”關系)和繼承(“is a”關系)。“has a”關系是通過定義類的屬性的方式實現的;而“is a”關系是通過類繼承實現的。本例中選項a、b、c體現了“is a”關系;選項d、e體現了“has a”關系。  

例題6:  
which two statements are true for the class java.util.treeset? (choose two)  
a. the elements in the collection are ordered.  
b. the collection is guaranteed to be immutable.  
c. the elements in the collection are guaranteed to be unique.  
d. the elements in the collection are accessed using a unique key.  

e. the elements in the collection are guaranteed to be synchronized  
解答:a, c  
  點評:treeset類實現了set接口。set的特點是其中的元素惟一,選項c正確。由于采用了樹形存儲方式,將元素有序地組織起來,所以選項a也正確。  

例題7:  
true or false: readers have methods that can read and return floats and doubles.  
a. ture  
b. false  
解答:b  
  點評: reader/writer只處理unicode字符的輸入輸出。float和double可以通過stream進行i/o.  

例題8:  
what does the following paint() method draw?  
1. public void paint(graphics g) {  
2. g.drawstring(“any question”, 10, 0);  
3. }  
a. the string “any question?”, with its top-left corner at 10,0  
b. a little squiggle coming down from the top of the ;component.  
解答:b  
  點評:drawstring(string str, int x, int y)方法是使用當前的顏色和字符,將str的內容顯示出來,并且最左的字符的基線從(x,y)開始。在本題中,y=0,所以基線位于最頂端。我們只能看到下行字母的一部分,即字母‘y’、‘q’的下半部分。
主站蜘蛛池模板: 色婷婷亚洲婷婷7月 | 欧美性欧美巨大黑白大战 | 超caopor在线公开视频 | 丰满少妇高潮惨叫在线观看 | 色综合久久久久久久久久久 | 自拍偷在线精品自拍偷99九色 | 51久久成人国产精品麻豆 | 欧美日韩国产精品一区 | 天堂资源中文网 | 综合国产精品久久久 | 国产黄色片在线免费观看 | 伊人中文在线 | 色94色欧美 | 久久久影院一区二区三区 | 色欲蜜桃AV无码中文字幕 | 色婷婷香蕉在线一区二区 | 激情综合色综合啪啪五月 | 国产精品系列在线观看 | 亚洲午夜久久久影院 | 男操女视频免费 | 五月丁香六月综合AV | 色视频网站 | 日韩人妻一区二区三区蜜桃视频 | 在线观看亚洲免费视频 | 91美剧网在线观看 | 妇欲欢公爽婷婷在线观看 | 亚洲AV无码片区一区二区三区 | 少妇宾馆把腿扒开让我添 | 国产精品一级毛片av | 欧美视频在线看 | 一本久久伊人热热精品中文字幕 | 国产成人无码免费网站 | 国产一区 | 五月色丁香综缴合 | 国产一级一片射内视频 | 色香蕉在线 | 中国视频一区二区 | 在线免费av网站 | 两个少妇给我口爆 | 亚洲AV综合色区无码二区爱AV | 做爰爽全过程免费的看 |