济宁蓖乒工艺品有限责任公司

當(dāng)前位置:

JAVA認證歷年真題:SCJP認證試題解析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認證考試報考指南  考試論壇 考試知道   考試動態(tài)

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

2頁,當(dāng)前第1頁  第一頁  前一頁  下一頁
最近更新 考試動態(tài) 更多>
图木舒克市| 三都| 邢台市| 化隆| 宁远县| 北碚区| 错那县| 奉节县| 沾化县| 山阳县| 登封市| 会理县| 宁陵县| 青冈县| 湛江市| 垫江县| 紫阳县| 大方县| 洛扎县| 北票市| 翁源县| 高要市| 普洱| 彭泽县| 双牌县| 湟中县| 青海省| 朝阳市| 巫溪县| 安丘市| 天镇县| 中西区| 大邑县| 东城区| 卫辉市| 开化县| 仙游县| 河北区| 鄢陵县| 印江| 定南县|