當(dāng)前位置:

JAVA認(rèn)證歷年真題:SCJP考試真題和解析7

發(fā)表時(shí)間:2014/4/21 9:54:55 來源:互聯(lián)網(wǎng) 點(diǎn)擊關(guān)注微信:關(guān)注中大網(wǎng)校微信
關(guān)注公眾號(hào)

19.Which declares for native method in a java class corrected?

A. public native void method(){}

B. public native void method();

C. public native method();

D. public void method(){native;}

E. public void native method();

19。B

native關(guān)鍵字指明是對(duì)本地方法的調(diào)用,在JAVA中是只能訪問但不能寫的方法,它的位置在訪問權(quán)限修飾語的后面及返回值的前面。

20. Which modifer should be applied to a declaration of a class member variable for the value of variable to remain constant after the creation of the object?

20。final

定義常量的方法是在變量定義前加final關(guān)鍵字。

21. Which is the main() method return of a application?

A. String

B. byte

C. char

D. void

21。D

main()方法沒有返回值,所以必須用void修飾。main()方法的返回值不能任意修改。

22. Which is corrected argument of main() method of application?

A. String args

B. String ar[]

C. Char args[][]

D. StringBuffer arg[]

22。B

main()方法的參數(shù)是字符串?dāng)?shù)組,參數(shù)名可以任意定義。

23. “The Employee object is a person, An Employee has appointment store in a    vector, a hire date and a number of dependent”

short answer: use shortest statement declare a class of Employee.

23。public class Employee extends Person

這也是真實(shí)考試中常見的一種題型。要注意題目敘述中“is a”表示 “extends”的含義。

24. Give the following class defination inseparate source files:

public class Example{

public Example(){//do something}

protected Example(int i){//do something}

protected void method(){//do something}

}

public class Hello extends Example{//member method and member variable}

Which methods are corrected added to the class Hello?

A. public void Example(){}

B. public void method(){}

C. protected void method(){}

D. private void method(){}

24。A、B、C

考察的知識(shí)點(diǎn)是方法覆蓋,其中要注意的是方法覆蓋時(shí),子類方法的訪問權(quán)限不能小于父類方法的訪問權(quán)限。另外,選項(xiàng)A并不是父類構(gòu)造函數(shù),它是子類中的新方法。

25. Float s=new Float(0.9F);

Float t=new Float(0.9F);

Double u=new Double(0.9);

Which expression?s result is true?

A. s==t

B. s.equals(t)

C. s==u

D. t.equals(u)

25。A、B

考察“==”及方法“equals()”的用法。注意以下幾點(diǎn)區(qū)別:

1) 引用類型比較引用;基本類型比較值。

2) equals()方法只能比較引用類型,“==”可比較引用及基本類型。

3) 當(dāng)用equals()方法進(jìn)行比較時(shí),對(duì)類File、String、Date及封裝類(Wrapper Class)來說,是比較類型及內(nèi)容。

4) 用“==”進(jìn)行比較時(shí),符號(hào)兩邊的數(shù)據(jù)類型必須一致(可相互轉(zhuǎn)換的基本類型除外),否則編譯出錯(cuò)

相關(guān)鏈接JAVA認(rèn)證考試報(bào)考指南  考試論壇 考試知道   考試動(dòng)態(tài)

(責(zé)任編輯:fky)

2頁,當(dāng)前第1頁  第一頁  前一頁  下一頁
最近更新 考試動(dòng)態(tài) 更多>