What is the result when you compile and run the following code?(二)

2014-11-16 18:20:03 · 作者: · 浏览: 45


E Compilation but runtime error at line 10.


Answer:______


**———————————————————————————————–**


8.[Select All]


[a]Vector filelist = ((Directory) file).getList();


[b]String[] filelist = file.directory();


[c]Enumeration filelist = file.contents();


[d]String[] filelist = file.list();


[e]Vector filelist = (new Directory(file)).files();


[Correct Choices]


Answer:______


**———————————————————————————————–**


9.Which most closely matches a description of a Java Map


a) A vector of arrays for a 2D geographic representation


b) A class for containing unique array elements


c) A class for containing unique vector elements


d) An interface that ensures that implementing classes cannot contain duplicate keys


Answer:______


**———————————————————————————————–**


10.Given the uncompleted method:


1)


2) { success = connect();


3} if (success==-1) {


4} throw new TimedOutException();


5} }


6}}


TimedOutException is not a RuntimeException. Which can complete the method of declaration when added at line 1


A. public void method()


B. public void method() throws Exception


C. public void method() throws TimedOutException


D. public void method() throw TimedOutException


E. public throw TimedOutException void method()


Answer:______
1A
2A
3D
4D
5A
6Answer: B
7A The compiler realizes that the get returns an Object reference which needs a cast to type Integer.
8[d]
9d
10bc