常州酌乒文化传播有限公司

當(dāng)前位置:

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

發(fā)表時間:2014/4/21 10:15:34 來源:互聯(lián)網(wǎng) 點擊關(guān)注微信:關(guān)注中大網(wǎng)校微信
關(guān)注公眾號

5. Which are syntactically valid statement at// point x?

class Person {

private int a;

public int change(int m){ return m; }

}

public class Teacher extends Person {

public int b;

public static void main(String arg[]){

Person p = new Person();

Teacher t = new Teacher();

int i;

// point x

}

}

A. i = m;

B. i = b;

C. i = p.a;

D. i = p.change(30);

E. i = t.b.

翻譯 在// point x處的哪些申明是句法上合法的。

答案D,E 解析

A:m沒有被申明過,不能使用。

B:雖然b是類Teacher的public成員變量,但是在靜態(tài)方法中不能使用類中的非靜態(tài)成員。

C:a是類Person的private成員,在類外不能直接引用。

D:change(int m)方法是public方法,并且返回一個int型值,可以通過類的實例變量p引用并賦值給一個int型變量。

E:b是類Teacher的public成員變量,且是int型,可以通過類的實例變量t引用并賦值給一個int型變量。

6. Which layout manager is used when the frame is resized the buttons′s position in the Frame might be changed?

A. BorderLayout

B. FlowLayout

C. CardLayout

D. GridLayout

翻譯 當(dāng)Frame的大小被改變時Frame中的按鈕的位置可能被改變時使用的哪一個布局管理器。

答案

B 解析

A:該布局管理器將容器劃分為五個部分,容器大小的改變不會影響其中的組件的位置而是影響他們的大小。

B:該布局管理器根據(jù)放入其中的組件的最合適大小調(diào)整組件的位置,根據(jù)組件放入的順序安排,一行不能容納時放入下一行,因此容器的大小改變可能改變組件的位置。

C:該布局管理器顯示放入該容器的當(dāng)前頁中的組件,一次顯示一個,容器大小的改變不能影響其中組件的位置。

D:該布局管理器將容器劃分為固定的網(wǎng)格,組件加入后占據(jù)一個單元,各組件的相對位置不會因為容器的大小變化而變化,改變的只是組件的大小。

7. Given the following code fragment:

1) public void create() {

2) Vector myVect;

3) myVect = new Vector();

4) }

Which of the following statements are true?

A. The declaration on line 2 does not allocate memory space for the variable myVect.

B. The declaration on line 2 allocates memory space for a reference to a Vector object.

C. The statement on line 2 creates an object of class Vector.

D. The statement on line 3 creates an object of class Vector.

E. The statement on line 3 allocates memory space for an object of class Vector

翻譯

給出下面的代碼片斷。。。下面的哪些陳述為true(真)?

A. 第二行的聲明不會為變量myVect分配內(nèi)存空間。

B. 第二行的聲明分配一個到Vector對象的引用的內(nèi)存空間。

C. 第二行語句創(chuàng)建一個Vector類對象。

D. 第三行語句創(chuàng)建一個Vector類對象。

E. 第三行語句為一個Vector類對象分配內(nèi)存空間。

答案A,D,E 解析

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

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

2頁,當(dāng)前第1頁  第一頁  前一頁  下一頁
最近更新 考試動態(tài) 更多>
车险| 皋兰县| 贵德县| 若尔盖县| 哈巴河县| 武宁县| 东莞市| 高尔夫| 册亨县| 临泽县| 嫩江县| 新营市| 平阴县| 礼泉县| 棋牌| 大关县| 微博| 寿宁县| 宜州市| 神农架林区| 银川市| 白山市| 克什克腾旗| 穆棱市| 九江县| 涟源市| 隆回县| 定日县| 梁平县| 华蓥市| 临朐县| 松溪县| 宁河县| 库尔勒市| 沙洋县| 临桂县| 岳阳县| 县级市| 扎兰屯市| 宝丰县| 曲靖市|