2009年2月17日 星期二

第150題

Given:
5. import java.io.*;
6. public class Talk{
7. public static void main(String[] args){
8. Console c = new Console();
9. String pw;
10. System.out.print("password: ");
11. pw = c.readLine();
12. System.out.println("got" + pw);
13. }
14. }

If the user types the password aiko when prompted, what is the result?

A. password: got
B. password: got aiko
C. password: aiko got aiko
D. An exception is thrown at runtime.
E. Compilation fails due to an error on line 8.

答案:E
參考:10-2 Console類別
----------------------------------------------------------------------
8. Console c = new Console(); //外部物件不能直接呼叫...,要用syatem.Console()

沒有留言:

張貼留言