|
3) case 2: 4) case 3:System.out.println(“Test 2”);break; 5) default:System.out.println(“end”); 6) } which value of x would cause “Test 2” to the output: A. 1 B. 2 C. 3 D. default
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()
6-10答案: 6。B.C 在开关语句中,标号总是不被当做语句的一部分,标号的作用就是做为条件判上一页 [1] [2] [3] [4] [5] [6] [7] 下一页 |
|
|
|
|
|
|
|