SCJP 1.6版考題 154

出自 陳富國維基館
前往: 導覽搜尋
Given that c is a reference to a valid java.io.Console object, 
which two code fragments read a line of text from the console? (Choose two.)
 A. String s = c.readLine();
 B. char[] c = c.readLine();
 C. String s = c.readConsole();
 D. char[] c = c.readConsole();
 E. String s = c.readLine("%s", "name ");
 F. char[] c = c.readLine("%s", "name ");

解答


Ans: A E

解說: 給定一個c是一個指向一個有效的java.io.Console 物件,那二個敘述可以從console讀取一行文字