广元煌褂旅行社

當(dāng)前位置:

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

發(fā)表時間:2015/6/11 14:14:34 來源:互聯(lián)網(wǎng) 點擊關(guān)注微信:關(guān)注中大網(wǎng)校微信
關(guān)注公眾號

7. Give incompleted method:

1)

2) { if(unsafe()){//do something…}

3) else if(safe()){//do the other…}

4) }

The method unsafe() well throe an IOException, which completes the method of declaration when added at line one?

A. public IOException methodName()

B. public void methodName()

C. public void methodName() throw IOException

D. public void methodName() throws IOException

E. public void methodName() throws Exception

8. Give the code fragment:

if(x>4){

System.out.println(“Test 1”);}

else if (x>9){

System.out.println(“Test 2”);}

else {

System.out.println(“Test 3”);}

Which range of value x would produce of output “Test 2”?

A. x<4

B. x>4

C. x>9

D. None

9. Give the following method:

public void example(){

try{

unsafe();

System.out.println(“Test1”);

}catch(SafeException e){System.out.println(“Test 2”);

}finally{System.out.println(“Test 3”);}

System.out.println(“Test 4”);

Which will display if method unsafe () run normally?

A. Test 1

B. Test 2

C. Test 3

D. Test 4

10. Which method you define as the starting point of new thread in a class from which new the thread can be excution?

A. public void start()

B. public void run()

C. public void int()

D. public static void main(String args[])

E. public void runnable()

11.Given the following class definition:

class A{

protected int i;

A(int i){

this.i=i;

}

}

which of the following would be a valid inner class for this class?

Select all valid answers:

A. class B{

}

B. class B extends A{

}

C. class B extends A{

B(){System.out.println(“i=”+i);}

}

D. class B{

class A{}

}

E. class A{}

12. Which modifier should be applied to a method for the lock of object this to be obtained prior to excution any of the method body?

A. synchronized

B. abstract

C. final

D. static

E. public

13. The following code is entire contents of a file called Example.java,causes precisely one error during compilation:

1) class SubClass extends BaseClass{

2) }

3) class BaseClass(){

4) String str;

5) public BaseClass(){

6) System.out.println(“ok”);}

7) public BaseClass(String s){

8) str=s;}}

9) public class Example{

10) public void method(){

11) SubClass s=new SubClass(“hello”);

12) BaseClass b=new BaseClass(“world”);

13) }

14) }

Which line would be cause the error?

A. 9 B. 10 C. 11 D.12

編輯推薦:

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

(責(zé)任編輯:)

2頁,當(dāng)前第1頁  第一頁  前一頁  下一頁
最近更新 考試動態(tài) 更多>
会泽县| 白城市| 富民县| 卓资县| 溧阳市| 华亭县| 宁陕县| 库车县| 浏阳市| 中宁县| 和静县| 兴安盟| 澄城县| 武夷山市| 奇台县| 杭锦旗| 长宁县| 三亚市| 湖州市| 云阳县| 大关县| 兴安盟| 岳普湖县| 忻城县| 高清| 宜黄县| 宕昌县| 澳门| 遵化市| 祁连县| 张家界市| 南投县| 大城县| 福清市| 商都县| 那坡县| 竹溪县| 奎屯市| 句容市| 承德县| 沾益县|