Given the following four Java file definitions:



Which set modifications enable the code to compile and run?

A.
At line n1, Insert:

At line n2, insert:

B.
At line n1, Insert:

At line n2, insert:

C.
At line n1, Insert:

At line n2, insert:

D.
At line n1, Insert:

At line n2, insert:

E.
At line n1, Insert:

At line n2, insert:

題解

import關鍵字可以引入類別或是介面,不是引入套件(package),因此選項A是錯誤的。

而選項B和選項C,需注意到「*」所指的是該套件下的所有類別或是介面,並不包含子套件。實際上也沒有在分子、母套件,只要套件名稱不同就是不同的套件。

選項D,語法錯誤了,不能使用「,」來分別引入不同的類別。

選項E才是正確的。