广元煌褂旅行社

當(dāng)前位置:

JAVA認(rèn)證考試專業(yè)語言模擬試題小測天天練1

發(fā)表時(shí)間:2015/6/7 15:33:02 來源:互聯(lián)網(wǎng) 點(diǎn)擊關(guān)注微信:關(guān)注中大網(wǎng)校微信
關(guān)注公眾號

Java 2 TEST

Question: 1

Given the following code:

class Test{

private int m;

public static void fun() {

// some code...

}

}

How can the member variable m be accessible directly in the method fun()?

A. change private int m to protected int m

B. change private int m to public int m

C. change private int m to static int m

D. change private int m to int m

Explanation:

If the variable m is changed to be a static variable it can be accessible in the method fun() for this method is a static member method.

Correct Answer: C 1 of 60

Question: 2

Which methods are correct overloading methods of the following method:

public void example(){...}

A. public void example( int m){...}

B. public int example(){...}

C. public void example2(){...}

D. public int example ( int m, float f){...}

Explanation:

The overloading methods must have the same names. If only the return type of the methods are different it is sufficient tell the methods from each other. The arguments of the methods must be different enough to determine which method to call.

Correct Answer: A,D 2 of 60

Question: 3

Given the following fragment of code:

public class Base{

int w, x, y ,z;

public Base(int a,int b){

x=a; y=b;

}

public Base(int a, int b, int c, int d){

// assignment x=a, y=b

w=d;

z=c;

}

}

Which expressions can be used at the point of // assignment x=a, y=b?

A. Base(a,b);

B. x=a, y=b;

C. x=a; y=b;

D. this(a,b);

Explanation:

In the second constructor, the call this(a,b) passes control the version of the constructor that takes two int arguments.

Correct Answer: C,D 3 of 60

編輯推薦:

JAVA認(rèn)證考試報(bào)考指南 / 更多JAVA考試模擬試題


(責(zé)任編輯:)

2頁,當(dāng)前第1頁  第一頁  前一頁  下一頁
最近更新 考試動(dòng)態(tài) 更多>
中牟县| 定远县| 安陆市| 洮南市| 乃东县| 平定县| 榆中县| 曲松县| 合川市| 珠海市| 内丘县| 吉首市| 台前县| 凌海市| 乌恰县| 靖远县| 武邑县| 淮滨县| 高雄市| 黄石市| 南投县| 长泰县| 中江县| 乐都县| 鄱阳县| 海口市| 阿克陶县| 和平区| 游戏| 岗巴县| 庆城县| 西贡区| 河南省| 宝应县| 嘉义市| 慈利县| 鄂托克前旗| 清流县| 株洲市| 东乡族自治县| 峡江县|